public IHttpActionResult PostDigitalInfoMaster(DigitalInfoMaster digitalInfoMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DigitalInfoMasters.Add(digitalInfoMaster); try { db.SaveChanges(); } catch (DbUpdateException) { if (DigitalInfoMasterExists(digitalInfoMaster.id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = digitalInfoMaster.id }, digitalInfoMaster)); }
public IHttpActionResult PutDigitalInfoMaster(int id, DigitalInfoMaster digitalInfoMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != digitalInfoMaster.id) { return(BadRequest()); } db.Entry(digitalInfoMaster).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DigitalInfoMasterExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetDigitalInfoMaster(int id) { DigitalInfoMaster digitalInfoMaster = db.DigitalInfoMasters.Find(id); if (digitalInfoMaster == null) { return(NotFound()); } return(Ok(digitalInfoMaster)); }
public IHttpActionResult DeleteDigitalInfoMaster(int id) { DigitalInfoMaster digitalInfoMaster = db.DigitalInfoMasters.Find(id); if (digitalInfoMaster == null) { return(NotFound()); } db.DigitalInfoMasters.Remove(digitalInfoMaster); db.SaveChanges(); return(Ok(digitalInfoMaster)); }