private static User GetAuthenticatedUser()
{
var httpContext = HttpContext.Current;
if (httpContext == null || !httpContext.Request.IsAuthenticated ||
!(httpContext.User.Identity is FormsIdentity))
{
return null;
}
return
DependencyResolver.Current.GetService<IUserService>()
.GetAll()
.FirstOrDefault(n => n.UserName == httpContext.User.Identity.Name);
}