public ActionResult DeleteConfirmed(int id) { PickUpArea pickUpArea = db.PickUpAreas.Find(id); db.PickUpAreas.Remove(pickUpArea); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Pua_ShouldSetDestinationCorrectly() { var timerServiceMock = new Mock <ITimerService>(); var puaIndex = 1; var pua = new PickUpArea(puaIndex, Guid.NewGuid().ToString(), timerServiceMock.Object); pua.Destination.ShouldBe($"P{puaIndex}"); }
public ActionResult Edit([Bind(Include = "AreaID")] PickUpArea pickUpArea) { if (ModelState.IsValid) { db.Entry(pickUpArea).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pickUpArea)); }
public ActionResult Create([Bind(Include = "AreaID,Zipcodes")] PickUpArea pickUpArea) { if (ModelState.IsValid) { db.PickUpAreas.Add(pickUpArea); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pickUpArea)); }
// GET: PickUpAreas/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PickUpArea pickUpArea = db.PickUpAreas.Find(id); if (pickUpArea == null) { return(HttpNotFound()); } return(View(pickUpArea)); }
public void Pua_ShouldPassTheBaggage_ToBagCollector() { var timerServiceMock = new Mock <ITimerService>(); var bagCollectorMock = new Mock <IChainLink>(); bagCollectorMock.Setup(cl => cl.Destination).Returns(typeof(BagCollector).Name); var bagMock = new Mock <Baggage>(); var pua = new PickUpArea(1, Guid.NewGuid().ToString(), timerServiceMock.Object); pua.AddSuccessor(bagCollectorMock.Object); pua.PassBaggage(bagMock.Object); bagMock.Object.Destination.ShouldBe(typeof(BagCollector).Name); }