/// <summary> /// Deletes a DataType entity /// </summary> /// <param name="item"></param> public void Delete(ShipmentCostDto item) { if (Unit != null) { Repository.Delete(item, false); } else { Repository.Delete(item); } }
public ActionResult Create(ShipmentCostDto viewModel) { if (ModelState.IsValid) { _shipmentCostService.Insert(viewModel); { return(RedirectToAction("List")); } } return(View(viewModel)); }
public void Update(ShipmentCostDto item) { //if Unit is not null means that the method is called after another method in the service and so it should not save the changes and commit the transaction. if (Unit != null) { Repository.Update(item, false); } //if Unit is null means that the method is the first and only method in the transaction and it can save the changes and commit the transaction. else { Repository.Update(item); } }
/// <summary> /// Insert a new ShipmentCost entity /// </summary> /// <param name="item">ShipmentCost entity</param> public void Insert(ShipmentCostDto item) { try { // if Unit is not null means that our service is called after another service. if (Unit != null) { this.Repository.Insert(item, false); // call data access insert } // if Unit is null means that our service is the first service that is calling repository. else { this.Repository.Insert(item); } } catch (Exception ex) { throw ex; } }
public ActionResult Edit(ShipmentCostDto viewModel) { _shipmentCostService.Update(viewModel); return(RedirectToAction("List")); }