Exemple #1
0
 public int AddRentalPackage(RentalPackageContract rentalPackage)
 {
     try
     {
         return _rentalPackageRepository.AddRentalPackage(rentalPackage);
     }
     catch (Exception ex)
     {
         ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
         return 0;
     }
 }
 public int AddRentalPackage(RentalPackageContract rentalPackage)
 {
     try
     {
         //Re-Map Object to Entity Object
         var myEntityObj = RentalPackageContractMapper.Map<RentalPackageContract, RentalPackage>(rentalPackage);
         if(myEntityObj == null)
         {return -2;}
         var processedRentalPackage =  _repository.Add(myEntityObj);
         _uoWork.SaveChanges();
         return  processedRentalPackage.RentalPackageId;
     }
     catch (Exception ex)
     {
         ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
         return 0;
     }
 }
 public ActionResult AddRentalPackage(RentalPackageContract model)
 {
     try
     {
         var rentalPackage = ServiceProvider.Instance().GetRentalPackageServices().GetRentalPackages() ?? new List<RentalPackageContract>();
         //model.Countrys = new SelectList(countryList, "CountryId", "Name", model.CountryId);
         if (!ModelState.IsValid)
         {
             return View(model);
         }
         var retVal = ServiceProvider.Instance().GetRentalPackageServices().AddRentalPackage(model);
         if (retVal < 1)
         {
             ModelState.AddModelError("message", "Unable to add Package");
             return View(model);
         }
         return RedirectToAction("RentalPackageList");
     }
     catch
     {
         ModelState.AddModelError("message", "Process Error Occurred!");
         return View(model);
     }
 }
Exemple #4
0
 public bool UpdateRentalPackage(RentalPackageContract rentalPackage)
 {
     try
     {
         return _rentalPackageRepository.UpdateRentalPackage(rentalPackage);
         }
     catch (Exception ex)
     {
         ErrorManager.LogApplicationError(ex.StackTrace, ex.Source, ex.Message);
         return false;
     }
 }
 //
 public ActionResult EditRentalPackageInfo(RentalPackageContract model)
 {
     try
     {
         var retVal = ServiceProvider.Instance().GetRentalPackageServices().UpdateRentalPackage(model);
         if (!retVal)
         {
             return PartialView("EditRentalPackage", model);
         }
         return RedirectToAction("RentalPackageList");
     }
     catch
     {
         return PartialView("EditRentalPackage", model);
     }
 }
 //
 public PartialViewResult AddRentalPackage()
 {
     var rentalPackage = new RentalPackageContract();
     return PartialView("AddRentalPackage", rentalPackage);
 }
 public JsonResult _AddRentalPackage(RentalPackageContract model)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return Json(new { IsSuccess = false, Message = "Invalid inputs / validation error" });
         }
         var retVal = ServiceProvider.Instance().GetRentalPackageServices().AddRentalPackage(model);
         if (retVal < 1)
         {
             return Json(new { IsSuccess = false, Message = "Invalid input / Package Already Exist" });
         }
         return Json(new { IsSuccess = true, Message = "" });
     }
     catch
     {
         return Json(new { IsSuccess = false, Message = "Invalid inputs / validation error" });
     }
 }