public async Task <IHttpActionResult> Put(Chore chore) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } chore.ObjectState = ObjectState.Modified; _choreService.Update(chore); try { await _unitOfWorkAsync.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChoreExists(chore.Id)) { return(NotFound()); } throw; } return(new NoContentActionResult(Request, Url.Link("GetChore", new { id = chore.Id }))); }
public Response Update(Chore chore) { _choreService.Update(chore); return(new Response { Body = "success" }); }
public IActionResult Put(int id, [FromBody] ChoreModel updatedChore) { var chore = _choreService.Update(updatedChore.ToDomainModel()); if (chore == null) { return(NotFound()); } //UNSURE return(Ok(chore.ToApiModel())); }
public Chore UpdateChore([FromBody] Chore chore, DayOfWeek?choreEditedDay = null) { if (chore == null) { throw new InvalidParameterException("Invalid parameters!"); } chore = _choreService.Update(chore, choreEditedDay); if (chore.FrequencyType != FrequencyType.Once) { _recurringChoreService.UpdateRecurringChore(chore.Id, chore.FrequencyType, _currentUserService.FamilyID, choreEditedDay); } return(chore); }