public IActionResult GetAvailableProblems() { if (User.Identity.Name == null) { return(Ok()); } var user = UserService.Get(long.Parse(User.Identity.Name)); if (user == null) { return(NotFound(new ResponseModel { Success = false, Message = "Пользователь не найден" })); } var problems = ProblemService.GetAll() .Where(x => x.User == user) .ToList() .Where(x => !IsProblemInWork(x)) .OrderByDescending(x => x.CreatedDate) .Select(x => new ProblemViewModel(x)) .ToList(); return(Ok(new DataResponse <List <ProblemViewModel> > { Data = problems })); }
public HttpResponse Index() { if (IsUserSignedIn()) { return(View(_problemService.GetAll(), "/IndexLoggedIn")); } return(View()); }