コード例 #1
0
 public ActionResult Edit(decimal id, Employee employee)
 {
     try
     {
         if (ModelState.IsValid)
         {
             Employee obj = Employee.Find(id);
             if (obj != null)
             {
                 obj = employee;
                 Employee.Update(obj);
                 ViewBag.Message = "Employee Updated Successfully";
             }
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View());
         }
     }
     catch (Exception ex)
     {
         return(View());
     }
 }
コード例 #2
0
        public ActionResult Edit(decimal id)
        {
            ViewData["Department"] = CommonConstant.BindDepartment();
            ViewData["Status"]     = CommonConstant.BindStatus();
            Employee obj = Employee.Find(id);

            if (obj != null)
            {
                return(View(obj));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }