public override bool Delete(MovieShopDBContext ctx, int id) { Movie o = ctx.Movies.FirstOrDefault(x => x.Id == id); ctx.Entry(o).State = EntityState.Deleted; return(true); }
public IHttpActionResult PutCustomer(int id, Customer customer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != customer.Id) { return(BadRequest()); } db.Entry(customer).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public override Order Create(MovieShopDBContext ctx, Order t) { ctx.Entry(t.Customer).State = EntityState.Unchanged; ctx.Orders.Add(t); ctx.SaveChanges(); return(t); }
public override bool Delete(MovieShopDBContext ctx, int id) { Customer o = ctx.Customer.FirstOrDefault(x => x.Id == id); ctx.Entry(o).State = EntityState.Deleted; ctx.SaveChanges(); return(true); }
public override Customer Update(MovieShopDBContext ctx, Customer c) { ctx.Entry(c).State = EntityState.Modified; ctx.SaveChanges(); return(c); }
public override Movie Update(MovieShopDBContext ctx, Movie t) { ctx.Entry(t).State = EntityState.Modified; return(t); }
public override Genre Update(MovieShopDBContext ctx, Genre t) { ctx.Entry(t).State = EntityState.Modified; ctx.SaveChanges(); return(t); }