public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var folderToEdit = await baseAsyncFolderRepo.GetByConditionAsync(filter : i => i.ID == id); ViewData["BoxID"] = folderToEdit.BoxID; return(View(folderToEdit)); }
public async Task <ActionResult> Details(int?id) { if (id == null) { TempData["ResourceName"] = getObjectType.GetObjectName <Box>(); return(RedirectToAction("StatusCodeErrorHandler", "Error", new { statusCode = 452 })); } var query = await baseAsyncBoxRepo.GetByConditionAsync(filter : b => b.ID == id, includeProperties : "Folders"); if (query == null) { TempData["ResourceName"] = getObjectType.GetObjectName <Box>(); TempData["ResourceId"] = id; return(RedirectToAction("StatusCodeErrorHandler", "Error", new { statusCode = 404 })); } return(View(query)); }
public async Task <IActionResult> GetCIF(string CIFNo) { var viewmodel = new CifManagedByViewModel(); if (CIFNo == null) { return(NotFound()); } viewmodel.CustData = await baseAsyncCustDataRepo.GetByConditionAsync (filter : cst => cst.CIFNo == CIFNo); if (viewmodel.CustData == null) { TempData["NotFound"] = CIFNo + " doesn't exists "; return(View("~/Views/Error/NotFound.cshtml")); } var h1 = viewmodel.PrjHelix1 = await baseAsyncPrjHelix1Repo.GetByConditionAsync (filter : cst => cst.CustDataCIFNo == CIFNo); var v1 = viewmodel.PrjVelocity1 = await baseAsyncPrjVelocity1Repo.GetByConditionAsync (filter : cst => cst.CustDataCIFNo == CIFNo); var v2 = viewmodel.PrjVelocity2 = await baseAsyncPrjVelocity2Repo.GetByConditionAsync (filter : cst => cst.CustDataCIFNo == CIFNo); if (h1 == null) { viewmodel.IsHelix1 = false; } else { viewmodel.IsHelix1 = true; } if (v1 == null) { viewmodel.IsVelocity1 = false; } else { viewmodel.IsVelocity1 = true; } if (v2 == null) { viewmodel.IsVelocity2 = false; } else { viewmodel.IsVelocity2 = true; } return(View(viewmodel)); }
public async Task <IActionResult> GetRelatedCif(int boxid, string accountno, string custidn) { int a = boxid; if (String.IsNullOrEmpty(accountno) && String.IsNullOrEmpty(custidn)) { return(NotFound()); } if (!String.IsNullOrEmpty(accountno) && String.IsNullOrEmpty(custidn)) { var acc = await baseAsyncCustAccRepo.GetByConditionAsync(filter : ac => ac.CustAccountNo == accountno, includeProperties : "CustRelDataEntries"); var allcifs = await baseAsyncCustDataRepo.GetAllAsync(); var accountcifs = new HashSet <string>(acc.CustRelDataEntries.Select(cf => cf.CustCIFNo)); ViewData["AccountNo"] = acc.CustAccountNo; var viewModel = new List <AssignedAccountData>(); foreach (var cif in allcifs) { viewModel.Add(new AssignedAccountData { CIFNo = cif.CIFNo.Trim(), CIFCustomerName = cif.CustomerName ?? "", Assigned = accountcifs.Contains(cif.CIFNo), BoxID = boxid }); } var model = viewModel.Where(a => a.Assigned == true).ToList(); return(View("GetRelatedCif", model)); } if (String.IsNullOrEmpty(accountno) && !String.IsNullOrEmpty(custidn)) { var allcifs = await baseAsyncCustDataRepo.GetAllAsync(filter : cd => cd.CustomerIDN.Contains(custidn) || cd.CustomerName.Contains(custidn)); var viewModel = new List <AssignedAccountData>(); foreach (var cif in allcifs) { viewModel.Add(new AssignedAccountData { CIFNo = cif.CIFNo.Trim(), CIFCustomerName = cif.CustomerName ?? "", BoxID = boxid }); } var model = viewModel.ToList(); return(View("GetRelatedCif", model)); } return(View()); }
public async Task <IActionResult> CIFExists(string custDataCIFNo) { var cif = await baseAsyncCustDataRepo.GetByConditionAsync(cd => cd.CIFNo == custDataCIFNo); if (cif != null) { return(Json(true)); } else { return(Json($" CIF doesn't exist. Please check out the spelling and if the problem persists contact operations ")); } }