コード例 #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));
        }
コード例 #2
0
 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));
        }
コード例 #7
0
 public RepairDTO Get(int repairId)
 {
     return(RepairMapper.Map(_bheUOW.RepairRepository.Query().Where(x => x.Id == repairId).FirstOrDefault()));
 }
コード例 #8
0
 public List <RepairDTO> GetAll()
 {
     return(RepairMapper.Map(_bheUOW.RepairRepository.Query().ToList()));
 }