public ActionResult DeleteConfirmed(long id) { CarriersPost carriers = _carriersService.GetPost(id); carriers.UserName = User.Identity.Name; _carriersService.Delete(carriers); return(RedirectToAction("Index")); }
public void Delete_works_Properly() { string errorMessagePrefix = "CarriersService Delete() method does not work properly."; var context = OilsProDbContextInMemoryFactory.InitializeContext(); this.carriersService = new CarriersService(context); var carrier = new Carrier { Name = "Carrier1" }; context.Carriers.Add(carrier); context.SaveChanges(); var result = carriersService.Delete(carrier.Id); Assert.True(result.isDeleted); }
public IActionResult Delete(string id) { var carrier = _carriersService.Delete(id); return(this.Redirect("/Nomenclatures/Carriers")); }