Exemplo n.º 1
0
        public async Task <ActionResult> Edit([Bind(Include = "userID,fname,lname,username,email,password")] EmployeeUser employeeUser)
        {
            if (ModelState.IsValid)
            {
                db.Entry(employeeUser).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(employeeUser));
        }
Exemplo n.º 2
0
 public ActionResult Add(EmployeeUser empuser)
 {
     using (EmployeeUserManagementModel db = new EmployeeUserManagementModel())
     {
         if (empuser.userID == 0)
         {
             db.EmployeeUsers.Add(empuser);
             db.SaveChanges();
             return(Json(new { success = true, message = "New user added successfully" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             db.Entry(empuser).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "User updated successfully" }, JsonRequestBehavior.AllowGet));
         }
     }
 }