Example #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);
     }
 }
        public ActionResult Create(ShipmentCostDto viewModel)
        {
            if (ModelState.IsValid)
            {
                _shipmentCostService.Insert(viewModel);

                {
                    return(RedirectToAction("List"));
                }
            }
            return(View(viewModel));
        }
Example #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);
     }
 }
Example #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;
     }
 }
 public ActionResult Edit(ShipmentCostDto viewModel)
 {
     _shipmentCostService.Update(viewModel);
     return(RedirectToAction("List"));
 }