public JsonResult Update_Hui(string name, DateTime date, string buoi, int sotien, string ghichu) { var kq = db.Detail_HuiHeo.Where(x => x.Name == name && x.Date == date).FirstOrDefault(); if (kq == null) { Detail_HuiHeo dt = new Detail_HuiHeo(); dt.Name = name; dt.Date = date; dt.Buoi = buoi; dt.SoTien = sotien; dt.GhiChu = ghichu; dt.Status = false; db.Detail_HuiHeo.Add(dt); db.SaveChanges(); return(Json(dt, JsonRequestBehavior.AllowGet)); } else { kq.Name = name; kq.Date = date; kq.Buoi = buoi; kq.SoTien = sotien; kq.GhiChu = ghichu; kq.Status = false; db.SaveChanges(); return(Json(kq, JsonRequestBehavior.AllowGet)); } }
public ActionResult View_Update_Hui(Detail_HuiHeo dt) { string date_format = String.Format("{0:yyyy-MM-dd}", dt.Date); ViewBag.Date = date_format; ViewBag.DateNonFortmat = dt.Date; ViewBag.List = db.List_Name_HuiHeo.ToList(); return(View()); }