public void UpdateShipper(ShipperViewModel shipper) { var shipperToRemove = _shipperRepository.GetById(shipper.ShipperC); var updateShipper = Mapper.Map <ShipperViewModel, Shipper_M>(shipper); _shipperRepository.Delete(shipperToRemove); _shipperRepository.Add(updateShipper); SaveShipper(); }
public ActionResult DeleteConfirmed(int id) { shipperRepository.Delete(id); shipperRepository.Save(); return(RedirectToAction("Index")); }
public void DeleteShipper(Expression <Func <Shipper, bool> > where) { var ListShipper = _repository.GetMany(where); foreach (var Shipper in ListShipper) { _repository.Delete(Shipper); } }
public bool Delete(int shipperId, out string message) { try { var entity = _ShipperRepository.GetById(shipperId); if (entity != null) { _ShipperRepository.Delete(shipperId); UnitOfwork.SaveChanges(); message = Constant.DeleteSuccess; return(true); } message = Constant.DeleteFail; return(false); } catch { message = Constant.RecordsisUsedCanNotDeleted; return(false); } }