public IHttpActionResult Putcampaignmaterial(int id, campaignmaterial campaignmaterial) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != campaignmaterial.ID) { return(BadRequest()); } db.Entry(campaignmaterial).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!campaignmaterialExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getcampaignmaterial(int id) { campaignmaterial campaignmaterial = db.campaignmaterials.Find(id); if (campaignmaterial == null) { return(NotFound()); } return(Ok(campaignmaterial)); }
public IHttpActionResult Postcampaignmaterial(campaignmaterial campaignmaterial) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.campaignmaterials.Add(campaignmaterial); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = campaignmaterial.ID }, campaignmaterial)); }
public IHttpActionResult Deletecampaignmaterial(int id) { campaignmaterial campaignmaterial = db.campaignmaterials.Find(id); if (campaignmaterial == null) { return(NotFound()); } db.campaignmaterials.Remove(campaignmaterial); db.SaveChanges(); return(Ok(campaignmaterial)); }