public static EnrolResponse BuildResponse(this Enrol request)
{
if (HttpContext.Current == null)
throw new PlatformNotSupportedException("This function can only be accessed from within ASP.NET");
string username = null;
if (HttpContext.Current.Request.IsAuthenticated)
username = HttpContext.Current.User.Identity.Name;
using (DiscoDataContext database = new DiscoDataContext())
{
EnrolResponse response = DeviceEnrolment.Enrol(database, username, request);
database.SaveChanges();
return response;
}
}