public static Product FromEntry(this ProductEntryModel detail) { return(new() { Description = detail.Description, IsActive = detail.IsActive.GetValueOrDefault(), Type = (int)detail.Type, Value = detail.Value.GetValueOrDefault() }); }
public ActionResult Index() { ViewBag.SuccessMsg = ViewBag.Failuremessage = ""; ViewBag.UsersInfo = _accountService.GetAllUsers(); ProductEntryModel wvm = new ProductEntryModel(); List <StoreData> WherehouseInfo = _accountService.StoreData(); WarehouseDisplay model = new WarehouseDisplay(); model.StoreData = WherehouseInfo; wvm.Display = model; return(View(wvm)); }
public ActionResult Index(ProductEntryModel md) { if (ModelState.IsValid) { string currentUser = HttpContext.User.Identity.Name; int seltedID = md.FormSubmit.StoreID; if (seltedID == 0) { bool retuenResult = _accountService.CreateWareHouse(md.FormSubmit.StoreName, md.FormSubmit.StoreManager, md.FormSubmit.StoreRoomNumber, md.FormSubmit.StoreType, currentUser); if (retuenResult == true) { ModelState.Clear(); ViewBag.SuccessMsg = "Wharehouse created successfully"; } } else { bool result = _accountService.UpdateWareHouse(md.FormSubmit.StoreName, md.FormSubmit.StoreManager, md.FormSubmit.StoreRoomNumber, md.FormSubmit.StoreType, md.FormSubmit.StoreID); if (result == true) { ModelState.Clear(); ViewBag.SuccessMsg = "Wharehouse updated successfully"; } else { ViewBag.Failuremessage = "Unable to update please try again later!"; } } } ViewBag.UsersInfo = _accountService.GetAllUsers(); ProductEntryModel wvm = new ProductEntryModel(); List <StoreData> WherehouseInfo = _accountService.StoreData(); WarehouseDisplay model = new WarehouseDisplay(); model.StoreData = WherehouseInfo; wvm.Display = model; return(View(wvm)); }