public IHttpActionResult PutinfoMaster(int id, infoMaster infoMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != infoMaster.Id) { return(BadRequest()); } db.Entry(infoMaster).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!infoMasterExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetinfoMaster(int id) { infoMaster infoMaster = db.infoMasters.Find(id); if (infoMaster == null) { return(NotFound()); } return(Ok(infoMaster)); }
public IHttpActionResult PostinfoMaster(infoMaster infoMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.infoMasters.Add(infoMaster); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = infoMaster.Id }, infoMaster)); }
public IHttpActionResult PostInfos(infoMaster info) { try { db.infoMasters.Add(info); db.SaveChanges(); return(Ok("Your data is inserted!")); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult DeleteinfoMaster(int id) { infoMaster infoMaster = db.infoMasters.Find(id); if (infoMaster == null) { return(NotFound()); } db.infoMasters.Remove(infoMaster); db.SaveChanges(); return(Ok(infoMaster)); }