public ActionResult ViewTask(int taskId) { ViewBag.Count = answerService.CountOfTrueAnswer(taskId); ViewBag.IsRate = answerService.IsRated(taskId, userService.GetUserId(User.Identity.Name)); var task = taskService.Find(taskId); ViewBag.IsSolved = answerService.IsSolved(taskId, userService.GetUserId(User.Identity.Name)); ViewBag.CreateUserId = task.CreateUserId; ViewBag.UserId = userService.GetUserId(User.Identity.Name); return(View(task.ToViewTaskModel())); }
public ActionResult ViewTask(int taskId) { ViewBag.Count = answerService.CountOfTrueAnswer(taskId); ViewBag.IsRate = answerService.IsRated(taskId, userService.GetUserId(User.Identity.Name)); var task = taskService.Find(taskId); ViewBag.IsSolved = answerService.IsSolved(taskId, userService.GetUserId(User.Identity.Name)); ViewBag.CreateUserId = task.CreateUserId; ViewBag.UserId = userService.GetUserId(User.Identity.Name); if (task.PhotoId.Count > 0) { List <byte> photo = photoService.FindPhoto(task.PhotoId[0]).ToList(); ViewBag.Photo = string.Format("data:image/gif;base64,{0}", Convert.ToBase64String(photo.ToArray())); } ViewBag.CreateUserName = userService.Find(userService.GetUserId(User.Identity.Name)).UserName; return(View(task.ToViewTaskModel())); }