예제 #1
0
 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));
 }
예제 #2
0
        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));
        }