public async Task <ActionResult> AddNewPaintCategory(PaintViewModel paintViewModel) { var isSuccess = await _paintService.AddNewPaintCategoryAsync(paintViewModel); return(isSuccess ? Json(new { status = TransactionStatusEnum.success.ToString(), title = "Success", message = "Paint Category has been saved successfully" }, JsonRequestBehavior.AllowGet) : Json(new { status = TransactionStatusEnum.error.ToString(), title = "Failed", message = "This Paint Category is already available" }, JsonRequestBehavior.AllowGet)); }
public async Task <bool> AddNewsubCategoryAsync(PaintViewModel paintViewModel) { using (var context = CreateContext()) { var result = await context.PaintSubCategory.AnyAsync(f => f.Value.ToLower() == paintViewModel.Value.ToLower() && f.PaintCategoryId == paintViewModel.PaintCategoryId && f.Status == (int)RecordStatusEnum.Active); if (!result) { var newSubCategory = new PaintSubCategory { Value = paintViewModel.Value, Description = paintViewModel.Description, PaintCategoryId = paintViewModel.PaintCategoryId, Status = (int)RecordStatusEnum.Active }; context.PaintSubCategory.Add(newSubCategory); await context.SaveChangesAsync(); return(true); } else { return(false); } } }
public async Task UpdatePaintAsync(PaintViewModel paintViewModel) { using (var context = CreateContext()) { var result = context.PaintMaster.FirstOrDefault(f => f.PaintMasterId == paintViewModel.PaintMasterId && f.Status == (int)RecordStatusEnum.Active); result.Quantity = paintViewModel.AvailableQuantity; result.Price = paintViewModel.Price; await context.SaveChangesAsync(); } }
public ActionResult AddPaint() { var paintViewModel = new PaintViewModel { Volumes = new SelectList(_lookUpServices.GetLookUp(LookUpTypeEnum.PaintVolume), "LookUpId", "Value"), PaintCatergoryList = new SelectList(_lookUpServices.GetLookUp(LookUpTypeEnum.PaintCategory), "LookUpId", "Value"), PaintSubategoryList = new SelectList(new List <LookUpBO>(), "LookUpId", "Value") }; return(View(paintViewModel)); }
public ActionResult Index() { var result = _lookUpServices.GetLookUp(LookUpTypeEnum.PaintCategory); var paintViewModel = new PaintViewModel { PaintCatergoryList = new SelectList(result, "LookUpId", "Value"), PaintSubategoryList = new SelectList(new List <LookUpBO>(), "LookUpId", "Value") }; return(View(paintViewModel)); }
public App() { var broadcastFactory = new ChainerFactory(16384); var networkServiceFactory = new NetworkServiceFactory(); _watcher = networkServiceFactory.CreateWatcher(); _broadcastService = new BroadcastService(broadcastFactory, _watcher, networkServiceFactory.CreateUtility()); InitializeBroadcastService(networkServiceFactory, _broadcastService); var frameworkDialogFactory = new DefaultFrameworkDialogFactory(); var dialogService = new DefaultDialogService(frameworkDialogFactory); var fileService = new DefaultFileService(new [] { ".lpsnp" }); _paintDataContext = new PaintViewModel(_broadcastService, dialogService, fileService, networkServiceFactory); }
public async Task <ActionResult> EditPaint(PaintViewModel paintViewModel) { await _paintService.UpdatePaintAsync(paintViewModel); return(Json(new { status = TransactionStatusEnum.success.ToString(), title = "Success", message = "Paint details have been updated successfully" }, JsonRequestBehavior.AllowGet)); }