public ActionResult Create([Bind(Include = "ID,CodeNo,GenNo,Maincategory,Category,TypeID,Purchaser,PurchaseDate,UseDate,EmpID,Status,Amount,Currency,Remark,ReturnSellAmount,ReturnCurrency")] Inventory inventory) { Inventory obj = new Inventory(); obj.ID = inventory.ID; obj.CodeNo = inventory.CodeNo; obj.GenNo = inventory.GenNo; obj.Maincategory = inventory.Maincategory; obj.Category = inventory.Category; obj.TypeID = inventory.TypeID; obj.Purchaser = inventory.Purchaser; obj.PurchaseDate = inventory.PurchaseDate; obj.UseDate = inventory.UseDate; obj.EmpID = inventory.EmpID; obj.Status = inventory.Status; obj.Amount = (inventory.Amount == null ? 0 : inventory.Amount); obj.Currency = (inventory.Currency == null ? 1 : inventory.Currency); obj.Remark = inventory.Remark; obj.ReturnSellAmount = (inventory.ReturnSellAmount == null?0:inventory.ReturnSellAmount); obj.ReturnCurrency = (inventory.ReturnCurrency == null ? 1 : inventory.ReturnCurrency); if (ModelState.IsValid) { db.Inventories.Add(obj); db.SaveChanges(); return(RedirectToAction("Stock")); } return(View(inventory)); }
public ActionResult Create([Bind(Include = "ID,MainCategory,Name,SortOrder")] Category category) { if (ModelState.IsValid) { db.Categories.Add(category); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Create([Bind(Include = "ID,Name,SortOrder,Type")] Models.UnitTypeModel unitType) { if (ModelState.IsValid) { db.UnitTypes.Add(unitType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(unitType)); }
public ActionResult Create([Bind(Include = "E_ID,E_FullName,E_Department,E_Position,E_Username,E_Active")] Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Create([Bind(Include = "Pos_ID,Pos_Name,Pos_SortOrder")] Position position) { if (ModelState.IsValid) { db.Positions.Add(position); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(position)); }
public ActionResult Create([Bind(Include = "H_ID,To_ID,FromDate,ToDate,ActiveID,Remark")] History history) { if (ModelState.IsValid) { db.Histories.Add(history); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(history)); }
public ActionResult Create([Bind(Include = "ID,Name,SortOrder")] Currency currency) { if (ModelState.IsValid) { db.Currencies.Add(currency); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(currency)); }
public ActionResult Create([Bind(Include = "ID,Name,SortOrder")] Department department) { if (ModelState.IsValid) { db.Departments.Add(department); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(department)); }
public ActionResult Create([Bind(Include = "ID,CodeNo,GenNo,Maincategory,Category,TypeID,Purchaser,PurchaseDate,UseDate,EmpID,Status,Amount,Currency,Remark,ReturnSellAmount,ReturnCurrency")] Inventory inventory) { if (ModelState.IsValid) { db.Inventories.Add(inventory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(inventory)); }
public ActionResult Create([Bind(Include = "UserID,UserName,Password")] LoginModel entity) { if (ModelState.IsValid) { user u = new user(); u.U_ID = 0; u.U_Name = entity.Username; string expectedHashString = Common.Encrypt(entity.Password); u.U_Password = expectedHashString; // u.U_Level = Common.Get_SALT(); u.U_Level = 0; db.users.Add(u); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(entity)); }
public int Delete(int id) { int success = 0; try { Inventory inv = (from invg in db.Inventories where invg.ID == id select invg).First <Inventory>(); if (inv != null) { db.Inventories.Remove(inv); success = db.SaveChanges(); } } catch { } return(success); }