// POST: odata/msInitials public async Task <IHttpActionResult> Post(msInitial msInitial) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.msInitials.Add(msInitial); await db.SaveChangesAsync(); return(Created(msInitial)); }
// DELETE: odata/msInitials(5) public async Task <IHttpActionResult> Delete([FromODataUri] int key) { msInitial msInitial = await db.msInitials.FindAsync(key); if (msInitial == null) { return(NotFound()); } db.msInitials.Remove(msInitial); await db.SaveChangesAsync(); return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/msInitials(5) public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <msInitial> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } msInitial msInitial = await db.msInitials.FindAsync(key); if (msInitial == null) { return(NotFound()); } patch.Put(msInitial); try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!msInitialExists(key)) { return(NotFound()); } else { throw; } } return(Updated(msInitial)); }