public ActionResult editwareHouse(Warehouse_tbl wh) { if (ModelState.IsValid) { wh.created_by = User.Identity.GetUserId(); wh.updated_at = DateTime.Now; db.Entry(wh).State = EntityState.Modified; db.SaveChanges(); message = "WareHouse Updated Successfully"; status = true; } else { message = "There Are some Problems.Try Agien"; } TempData["Message"] = message; TempData["Status"] = status; return(RedirectToAction("wareHouse")); }
public ActionResult wareHouse(wareHouse_VM wvm) { var wh = new Warehouse_tbl(); if (ModelState.IsValid) { wh.created_at = DateTime.Now; wh.created_by = User.Identity.GetUserId(); wh.w_name = wvm.name; wh.w_location = wvm.location; db.Warehouse_tbl.Add(wh); db.SaveChanges(); status = true; message = "Ware House Created Successfully"; } else { message = "Ther ARe somw Problem"; } TempData["Message"] = message; TempData["Status"] = status; return(RedirectToAction("wareHouse")); }