public IHttpActionResult PutRecoveryInterval(int id, RecoveryIntervalsDTO recoveryInterval) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != recoveryInterval.ID) { return(BadRequest()); } repository.Put(recoveryInterval); try { repository.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RecoveryIntervalExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostRecoveryInterval(RecoveryIntervalsDTO recoveryInterval) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } repository.Add(recoveryInterval); repository.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = recoveryInterval.ID }, recoveryInterval)); }