public void Update(StackeholdersDTO stackeholdersDTO) { Stackeholders stackeholders = new Stackeholders(); stackeholders.Id = stackeholdersDTO.Id; stackeholders.StackeholderName = stackeholdersDTO.StackeholderName; stackeholders.Mobile = stackeholdersDTO.Mobile; stackeholders.Rank = stackeholdersDTO.Rank; stackeholders.Description = stackeholdersDTO.Description; stackeholders.ProjectId = stackeholdersDTO.ProjectId; _context.Entry(stackeholders).State = EntityState.Modified; }
public StackeholdersDTO GetById(int id) { var stack = _context.stackeholders.Include(p => p.Project).FirstOrDefault(e => e.Id == id); StackeholdersDTO stackeholdersDTO = new StackeholdersDTO { Id = stack.Id, StackeholderName = stack.StackeholderName, ProjectId = stack.ProjectId, ProjectName = stack.Project.ProjectName, Mobile = stack.Mobile, Rank = stack.Rank, Description = stack.Description }; return(stackeholdersDTO); }
public IActionResult PutStackeholdersDTO(int id, StackeholdersDTO stackeholdersDTO) { if (id != stackeholdersDTO.Id) { return(BadRequest()); } _stackeholdersRepository.Update(stackeholdersDTO); try { _stackeholdersRepository.Save(); } catch (DbUpdateConcurrencyException ex) { string message = ex.Message; } return(NoContent()); }