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