public IActionResult Edit(ProjectTaskFilledVm projectTaskFilledVm) { logger.LogDebug($"ProjectTask.Edit [post] is called"); try { if (projectTaskFilledVm == null) { throw new ArgumentException("Variable shuld not be null", nameof(projectTaskFilledVm)); } if (ModelState.IsValid) { ProjectTaskDto projectTaskDto = ConvertToProjectTaskDto.Convert(projectTaskFilledVm.ProjectTasks); ProjectTaskService.Update(projectTaskDto); } else { return(View(projectTaskFilledVm)); } } catch (Exception ex) { logger.LogError(ex.Message); return(View("Error")); } return(RedirectToAction(nameof(Index))); }
public ActionResult MarkTaskAsDone(Guid projectId, Guid projectTaskId, string userEmail, Guid promoId) { var task = service.Get(projectTaskId); task.EndDate = DateTime.Now; service.Update(projectId, projectTaskId, task); return(RedirectToAction("Index", "Project", new { projectId = projectId, userEmail = userEmail })); }
// PUT api/projecttask/update public IHttpActionResult Put([FromBody] ProjectTaskVM projectTaskVM) { var sourceProject = _projectTaskService.GetById(projectTaskVM.Id); if (sourceProject == null) { return(NotFound()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var projectTaskDTO = _mapper.Map <ProjectTaskDTO>(projectTaskVM); _projectTaskService.Update(projectTaskDTO); return(CreatedAtRoute("GetProjectTask", new { id = projectTaskVM.Id }, projectTaskVM)); }
public IActionResult Update(int id, [FromBody] UpdateProjectTaskInput input) { input.Id = id; _taskService.Update(input); return(Created("", new { id })); }