public ActionResult DeleteConfirmed(long id)
        {
            CarriersPost carriers = _carriersService.GetPost(id);

            carriers.UserName = User.Identity.Name;
            _carriersService.Delete(carriers);
            return(RedirectToAction("Index"));
        }
Пример #2
0
        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);
        }
Пример #3
0
        public IActionResult Delete(string id)
        {
            var carrier = _carriersService.Delete(id);

            return(this.Redirect("/Nomenclatures/Carriers"));
        }