public void Add(OrderLine orderLine) { using (var ctx = new MovieStoreContext()) { ctx.OrderLines.Add(orderLine); ctx.SaveChanges(); } }
public void orderline_properties_set_test() { OrderLine line = new OrderLine(); var movie = new Movie() { Id = 1, Title = "Bog Foot" }; line.Movie = movie; line.Amount = 10; Assert.AreEqual(line.Movie, movie, "My movie "); Assert.AreEqual(line.Amount, 10, "Amount should be 10"); }
public ActionResult Create(OrderLine OL, FormCollection collection) { if (ModelState.IsValid) { fac.GetOrderLineRepository().Add(OL); return RedirectToAction("Index", new {id = OL.Id }); } ViewBag.MovieId = new SelectList(fac.GetMovieRepository().ReadAll(), "Id", "Title"); return View(); }
public void UpdateOrderLine(OrderLine orderLine) { using (var ctx = new MovieStoreContext()) { OrderLine m = ctx.OrderLines.Where(x => x.OrderId == orderLine.OrderId).First(); m.Amount = orderLine.Amount; m.OrderId = orderLine.OrderId; m.MovieId = orderLine.MovieId; m.Movie = orderLine.Movie; m.Order = orderLine.Order; ctx.SaveChanges(); } }
public void RemoveOrderLine(OrderLine line) { orderLines.Remove(line); }
public void AddOrderLine(OrderLine line) { orderLines.Add(line); }