Ejemplo n.º 1
0
 /// <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);
     }
 }
Ejemplo n.º 2
0
        public ActionResult Create(ShipmentCostDto viewModel)
        {
            if (ModelState.IsValid)
            {
                _shipmentCostService.Insert(viewModel);

                {
                    return(RedirectToAction("List"));
                }
            }
            return(View(viewModel));
        }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
 /// <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;
     }
 }
Ejemplo n.º 5
0
 public ActionResult Edit(ShipmentCostDto viewModel)
 {
     _shipmentCostService.Update(viewModel);
     return(RedirectToAction("List"));
 }