public ActionResult Index(NhaKho hh) { string message = string.Empty; if (hh.ID_NhaKho == 0) { var nhhs = new NhaKho() { SoTang = hh.SoTang, SoHang = hh.SoHang, SoCot = hh.SoCot, Status = "Sẵn sàng", }; khoDao.Insert(nhhs); message = "Thêm xong"; } else { var nhh = khoDao.NhaKho(hh.ID_NhaKho); nhh.SoTang = hh.SoTang; nhh.SoHang = hh.SoHang; nhh.SoCot = hh.SoCot; nhh.Status = hh.Status; khoDao.Update(); message = "Cập nhật xong"; } return(Json(data: new { message = "Thành công " + message, success = true }, JsonRequestBehavior.AllowGet)); }
public frmEdit_NhaKho(NhaKho obj) { InitializeComponent(); ucBaseEdit1.iFormBase = this; mObj = obj; StartPosition = FormStartPosition.CenterScreen; }
public ActionResult Edit(NhaKho ob) { var db = new dbQLKhoEntities(); db.Entry(ob).State = ob.ID_NhaKho > 0 ? System.Data.Entity.EntityState.Modified : System.Data.Entity.EntityState.Added; db.SaveChanges(); return(RedirectToAction("Index")); }
public override bool Add() { var ob = new NhaKho() { Status = "SanSang" }; if (new frmEdit_NhaKho(ob).ShowDialog() == System.Windows.Forms.DialogResult.Yes) { var db = new dbQLKhoEntities(); db.NhaKhoes.Add(ob); return(db.SaveChanges() > 0); } return(false); }
public ActionResult Send(int id) { List <NhaKho> items = khoDao.GetNhaKhos(); var nhh = new NhaKho(); foreach (var item in items) { if (item.ID_NhaKho == id) { nhh.ID_NhaKho = item.ID_NhaKho; nhh.SoTang = item.SoTang; nhh.SoHang = item.SoHang; nhh.SoCot = item.SoCot; nhh.Status = item.Status; } } return(Json(nhh, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int?id = null) { NhaKho ob = new NhaKho() { Status = "SanSang" }; ViewBag.Title = "THÊM MỚI NHÀ KHO"; if (id.HasValue) { ob = new dbQLKhoEntities().NhaKhoes.ToList().FirstOrDefault(q => q.ID_NhaKho == id); if (ob == null) { RedirectToAction("Index"); } ViewBag.Title = "SỬA NHÀ KHO"; } return(View(ob)); }
public void Insert(NhaKho nk) { db.NhaKhoes.Add(nk); db.SaveChanges(); }