public IHttpActionResult EditProject(ProjectDTO edited) { _projectServ.EditProject(edited); if(ModelState.IsValid && _projectServ.CheckExists(edited.Id)) { return Ok(); } else { return BadRequest(); } }
public void EditProject(ProjectDTO edited) { var project = _projectRepo.Get(edited.Id).FirstOrDefault(); project.Title = edited.Title; project.Budget = edited.Budget; project.State = (edited.State == null) ? (Project.Status)Enum.Parse(typeof(Project.Status), "ToDo") : (Project.Status)Enum.Parse(typeof(Project.Status), edited.State); project.EstStart = edited.EstStart; project.EstCompleted = edited.EstCompleted; project.Description = edited.Description; _projectRepo.SaveChanges(); }