public DiaryLogUpdateDtoTest() { _log = new DiaryLogUpdateDto() { Description = "I am here to update this field" }; }
public ActionResult UpdateDiaryLog(int id, int userId, DiaryLogUpdateDto diaryLogUpdateDto) { var logModelFromRepo = _diaryLogRepo.GetReflectiveDiaryLogById(id); if (logModelFromRepo == null) { return(NotFound()); } else if (logModelFromRepo.UserId == userId) { _mapper.Map(diaryLogUpdateDto, logModelFromRepo); _diaryLogRepo.UpdateDiaryLog(logModelFromRepo); _diaryLogRepo.SaveChanges(); return(NoContent()); } else { return(BadRequest()); } }