public IHttpActionResult PostPizzaSauce(PizzaSauce pizzaSauce) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PizzaSauces.Add(pizzaSauce); try { db.SaveChanges(); } catch (DbUpdateException) { if (PizzaSauceExists(pizzaSauce.SauceName)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = pizzaSauce.SauceName }, pizzaSauce)); }
public IHttpActionResult PutPizzaSauce(string id, PizzaSauce pizzaSauce) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pizzaSauce.SauceName) { return(BadRequest()); } db.Entry(pizzaSauce).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PizzaSauceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public Pizza(int pizzaID, string name, PizzaSize size, PizzaDough dough, PizzaSauce sauce) { PizzaID = pizzaID; Name = name; Size = size; Dough = dough; Sauce = sauce; }
public Pizza(int pizzaID, string name, PizzaSize size, PizzaDough dough, PizzaSauce sauce) { this.PizzaID = pizzaID; this.Name = name; this.Size = size; this.Dough = dough; this.Sauce = sauce; }
public Pizza(int pizzaID, string name, PizzaSize size, PizzaDough dough, PizzaSauce sauce, ObservableCollection <Topping> toppings) { this.PizzaID = pizzaID; this.Name = name; this.Size = size; this.Dough = dough; this.Sauce = sauce; this.Toppings = toppings; }
public IHttpActionResult GetPizzaSauce(string id) { PizzaSauce pizzaSauce = db.PizzaSauces.Find(id); if (pizzaSauce == null) { return(NotFound()); } return(Ok(pizzaSauce)); }
public IHttpActionResult DeletePizzaSauce(string id) { PizzaSauce pizzaSauce = db.PizzaSauces.Find(id); if (pizzaSauce == null) { return(NotFound()); } db.PizzaSauces.Remove(pizzaSauce); db.SaveChanges(); return(Ok(pizzaSauce)); }