public ActionResult Create(UserTaskViewModel userTask) { if (ModelState.IsValid) { var taskResult = MapperGetUserTasks(userTask); userTaskService.Create(taskResult); return(RedirectToAction("Index")); } return(View(userTask)); }
public async Task <IActionResult> Create(UserTaskRequest request) { if (request == null) { return(BadRequest(request)); } var position = _mapper.Map <UserTask>(request); var result = await _userTaskService.Create(position); var response = _mapper.Map <UserTaskResponse>(result); return(Ok(response)); }
public ActionResult Laboratory(StudentTaskViewModel model) { Task task = taskService.GetAll().Where(x => x.ID == model.ID).FirstOrDefault(); if (task != null) { var identity = (ClaimsIdentity)User.Identity; var id = identity.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier).Value; userTaskService.Create(new UserTask { TaskID = model.ID, UserID = int.Parse(id), Answer = model.Answer }); return(RedirectToAction("Task")); } return(View()); }
public ActionResult Create(ExtentionTaskViewModel task) { if (ModelState.IsValid) { userTaskService.Delete(userTaskService.GetAll().Where(x => x.ID == task.ID).FirstOrDefault()); userTaskService.Create(new UserTask { Answer = task.Answer, Comment = task.Comment, Grade = task.Grade, TaskID = (int)task.TaskID, UserID = (int)task.UserID }); return(RedirectToAction("Index", "Profile")); } ViewBag.Grade = new SelectList(new List <string>() { "Отлично", "Хорошо", "Удовлетворительно", "Неудовлетворительно" }, "ID", task.Grade); return(View(task)); }