public ActionResult Create(int? id) { var userName = System.Web.HttpContext.Current.User.Identity.Name; var user = _systemService.GetUserAndRole(0, userName); if (user == null) { return RedirectToAction("Index", "Login"); } if (user.StockR == 0) { return RedirectToAction("Index", "Home"); } var item = new WAMS_STOCK(); if (id.HasValue) { item = _service.GetByKey(id.Value); } var model = new StockViewModel { Id = item.Id, vStockID = item.vStockID, vStockName = item.vStockName, vRemark = item.vRemark, bUnitID = item.bUnitID, vBrand = item.vBrand, bCategoryID = item.bCategoryID, bPositionID = item.bPositionID, //bLabelID = item.bLabelID, bWeight = item.bWeight, vAccountCode = item.vAccountCode, iType = item.iType, PartNo = item.PartNo, PartNoFor = item.PartNoFor, PartNoMiniQty = item.PartNoMiniQty, RalNo = item.RalNo, ColorName = item.ColorName, Position = item.Position, SubCategory = item.SubCategory, UserForPaint = item.UserForPaint, Timestamp = item.Timestamp, UserLogin = user, Types = new SelectList(_systemService.TypeStockList(), "Id", "Name"), Categories = new SelectList(_systemService.CategoryStockList(0), "Id", "Name"), Units = new SelectList(_systemService.UnitStockList(0), "Id", "Name"), Positions = new SelectList(_systemService.PositionStockList(), "Id", "Name") //Labels = new SelectList(_systemService.LabelStockList(0), "Id", "Name") }; return View(model); }
public bool Insert(WAMS_STOCK stock) { _repository.Add(stock); _unitOfWork.CommitChanges(); return true; }
public bool Update(WAMS_STOCK stock) { _repository.Update(stock); _unitOfWork.CommitChanges(); return true; }