示例#1
0
        public JsonResult GetRepairList(IDataTablesRequest request)
        {
            var allData  = RepairMapper.Map(_repairBL.GetAll());
            var response = DataTableServerSideHelper <RepairVM> .ProcessData(allData, request);

            return(new DataTablesJsonResult(response, JsonRequestBehavior.AllowGet));
        }
 public int Add(RepairDTO repairDTO)
 {
     try
     {
         Repair entity = RepairMapper.Map(repairDTO);
         _bheUOW.RepairRepository.Add(entity);
         _bheUOW.SaveChanges();
         return(entity.Id);
     }
     catch (Exception ex)
     {
         ExceptionHandler exceptionHandler = new ExceptionHandler();
         exceptionHandler.WrapLogException(ex);
         throw ex;
     }
 }
示例#3
0
        public ActionResult Edit(RepairVM model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (model.ServiceReportBillFileBase != null)
                    {
                        model.ServiceReportBillFile = model.ServiceReportBillFileBase.FileName;
                    }

                    if (model.VendorInvoicesFileBase != null)
                    {
                        model.VendorInvoicesFile = model.VendorInvoicesFileBase.FileName;
                    }

                    var invoiceId = _repairBL.Update(RepairMapper.Map(model));
                    if (invoiceId > 0)
                    {
                        var filePath = ConfigurationManager.AppSettings["RepairFilePath"] + invoiceId + "\\";
                        UploadFile(model.VendorInvoicesFileBase, filePath);
                        UploadFile(model.ServiceReportBillFileBase, filePath);
                        TempData["Success"] = "Entry saved successfully";
                    }
                    else
                    {
                        return(View("Edit", model));
                    }
                }
                else
                {
                    return(View("Edit", model));
                }

                return(View("../RepairHome/RepairHome"));
            }
            catch
            {
                TempData["Exception"] = "The server encountered an error while processing the request. Please contact the technical team.";
                return(View("Edit", model));
            }
        }
示例#4
0
 public ActionResult Delete(int Id)
 {
     try
     {
         if (Id != 0)
         {
             var isDeleted = _repairBL.Delete(Id);
             if (isDeleted)
             {
                 TempData["Success"] = "Entry deleted successfully";
                 return(View("../RepairHome/RepairHome"));
             }
         }
         return(RedirectToAction("Details", Id));
     }
     catch
     {
         TempData["Exception"] = "The server encountered an error while processing the request. Please contact the technical team.";
         var repair = RepairMapper.Map(_repairBL.Get(Id));
         return(View("Details", repair));
     }
 }
示例#5
0
        public ActionResult Edit(int id)
        {
            var repair = RepairMapper.Map(_repairBL.Get(id));

            return(View("Edit", repair));
        }
示例#6
0
        public ActionResult Details(int id)
        {
            var repair = RepairMapper.Map(_repairBL.Get(id));

            return(View("Details", repair));
        }
 public RepairDTO Get(int repairId)
 {
     return(RepairMapper.Map(_bheUOW.RepairRepository.Query().Where(x => x.Id == repairId).FirstOrDefault()));
 }
 public List <RepairHomeDTO> GetAllForHome()
 {
     return(RepairMapper.MapForHome(_bheUOW.RepairRepository.Query().ToList()));
 }
 public List <RepairDTO> GetAll()
 {
     return(RepairMapper.Map(_bheUOW.RepairRepository.Query().ToList()));
 }