public IHttpActionResult PutCustomerArtistInfo(long id, CustomerArtistInfo customerArtistInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customerArtistInfo.cust_artist_id) { return(BadRequest()); } db.InsertOrUpdate(customerArtistInfo); try { db.Save(); } catch (DbUpdateConcurrencyException) { if (!CustomerArtistInfoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetCustomerArtistInfo(long id) { CustomerArtistInfo customerArtistInfo = db.Find(id); if (customerArtistInfo == null) { return(NotFound()); } return(Ok(customerArtistInfo)); }
public IHttpActionResult PostCustomerArtistInfo(CustomerArtistInfo customerArtistInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.InsertOrUpdate(customerArtistInfo); db.Save(); return(CreatedAtRoute("DefaultApi", new { id = customerArtistInfo.cust_artist_id }, customerArtistInfo)); }
public void InsertOrUpdate(CustomerArtistInfo customerartistinfo) { if (customerartistinfo.cust_artist_id == default(long)) { // New entity context.CustomerArtistInfoes.Add(customerartistinfo); } else { // Existing entity context.Entry(customerartistinfo).State = System.Data.Entity.EntityState.Modified; } }
public IHttpActionResult DeleteCustomerArtistInfo(long id) { CustomerArtistInfo customerArtistInfo = db.Find(id); if (customerArtistInfo == null) { return(NotFound()); } db.Delete(id); db.Save(); return(Ok(customerArtistInfo)); }