public JsonResult Creat(EmpPersonal Pdatacreat, EmpUnit Udatacreat) { using (EmpEntity db = new EmpEntity()) { db.EmpPersonal.Add(Pdatacreat); db.EmpUnit.Add(Udatacreat); db.SaveChanges(); } return(Json(JsonRequestBehavior.AllowGet)); }
public JsonResult Edit(EmpViewModel datasava) { using (EmpEntity db = new EmpEntity()) { EmpPersonal P = db.EmpPersonal.Where(x => x.EmpNumber == datasava.EmpNumber).FirstOrDefault(); P.EmpName = datasava.EmpName; P.EmpSex = datasava.EmpSex; P.EmpBirthday = datasava.EmpBirthday; P.CreationDate = datasava.CreationDate; P.LastloginDate = datasava.LastloginDate; P.Seniority = datasava.Seniority; EmpUnit U = db.EmpUnit.Where(x => x.EmpNumber == datasava.EmpNumber).FirstOrDefault(); U.UnitName = datasava.UnitName; U.UnitNumber = datasava.UnitNumber; U.JobTitle = datasava.JobTitle; db.SaveChanges(); } return(Json(JsonRequestBehavior.AllowGet)); }