public ActionResult CreateBlog() { int userId = _principalResolver.GetUserId(); var blog = _blogService.GetUserBlog(userId); if (blog != null) { // если один блог уже есть, больше создавать не даём return(RedirectToAction("Index")); } var model = new Blog(); return(View("BlogEditor", model)); }
public ResultModel GetTicketsPageForUser(int page, int pageSize) { int totalCount; int userId = _resolver.GetUserId(); var serviceRes = _supportTicketService.GetTicketsForUser(userId, new PagingFilter { Page = page, PageSize = pageSize }, out totalCount); var res = _mapper.Map <ICollection <TicketVM> >(serviceRes); return(new ResultModel(true, new { Tickets = res, TotalCount = totalCount })); }
public void RemoveUser(string username) { var user = _userGateway.SelectByUsername(username); IPrincipalResolver principal = DependencyResolver.Current.GetService <IPrincipalResolver>(); if (user.UserId == principal.GetUserId()) { throw new Exception("Вы не можете удалить себя"); } _userGateway.Delete(user.UserId); }