public IHttpActionResult PostAssettype(Assettype assettype) { db.Assettypes.Add(assettype); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = assettype.at_id }, assettype)); }
public IHttpActionResult PutAssettype(decimal id, Assettype assettype) { if (id != assettype.at_id) { return(BadRequest()); } db.Entry(assettype).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AssettypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetAssettype(decimal id) { Assettype assettype = db.Assettypes.Find(id); if (assettype == null) { return(NotFound()); } return(Ok(assettype)); }
public IHttpActionResult PostAssettype(Assettype assettype) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Assettypes.Add(assettype); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = assettype.at_id }, assettype)); }
public IHttpActionResult DeleteAssettype(decimal id) { Assettype assettype = db.Assettypes.Find(id); if (assettype == null) { return(NotFound()); } db.Assettypes.Remove(assettype); db.SaveChanges(); return(Ok(assettype)); }