Ejemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "UserTypeId,UserTypeName")] UserType usertype)
 {
     try
     {
         if (ModelState.IsValid)
         {
             UserType getusertypename = UsertypeService.GetUserByName(usertype.UserTypeName);
             if (getusertypename == null || usertype.UserTypeId == getusertypename.UserTypeId)
             {
                 UsertypeService.UpdateUserType(usertype);
                 UsertypeService.SaveChange();
                 return(RedirectToAction("Index"));
             }
             ViewBag.Error = "User Already Exist";
             return(View(usertype));
         }
         return(View(usertype));
     }
     catch
     {
         return(View(usertype));
     }
 }