/// <summary> /// Deletes a DataType entity /// </summary> /// <param name="item"></param> public void Delete(ShipmentMethodDto item) { if (Unit != null) { Repository.Delete(item, false); } else { Repository.Delete(item); } }
public ActionResult Create([Bind(Include = "ShipmentMethodId,Description")] ShipmentMethodDto shipmentMethod) { if (ModelState.IsValid) { _shipmentMethodService.Insert(shipmentMethod); { return(RedirectToAction("List")); } } return(View(shipmentMethod)); }
public void Update(ShipmentMethodDto 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 ShipmentMethod entity /// </summary> /// <param name="item">ShipmentMethod entity</param> public void Insert(ShipmentMethodDto 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(ShipmentMethodDto viewModel) { _shipmentMethodService.Update(viewModel); return(RedirectToAction("List")); }