示例#1
0
 // save user after editing
 public ActionResult saveUser(UserViewDTO userView)
 {
     if (userView.UserName == null || userView.Password == null || userView.UserLevel == 0 || userView.UserEmail == null || userView.UID == 0)
     {
         ViewData["User"] = userView;
         return(View("Edit"));
     }
     else
     {
         UserWSReference.UserDTO user = new UserWSReference.UserDTO
         {
             UID       = userView.UID,
             UserName  = userView.UserName,
             Password  = userView.Password,
             UserLevel = userView.UserLevel,
             UserEmail = userView.UserEmail
         };
         if (userClient.IsUserUpdated(user))
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View("Edit"));
         }
     }
 }
示例#2
0
 // add user to database
 public ActionResult AddUser(UserViewDTO userView)
 {
     UserWSReference.UserDTO user = new UserWSReference.UserDTO
     {
         UID       = userView.UID,
         UserName  = userView.UserName,
         Password  = userView.Password,
         UserLevel = userView.UserLevel,
         UserEmail = userView.UserEmail
     };
     if (userClient.IsUserInserted(user))
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         return(RedirectToAction("Create"));
     }
 }