public ActionResult UpdateUser(UsersPO form) { ActionResult oresponse = null; try { if (ModelState.IsValid) { UsersDO dataObject = UsersMap1.UsersPOtoDO(form); _usersDataAccess.UpdateUser(dataObject); oresponse = RedirectToAction("ViewUsers", "Users"); } else { oresponse = View(form); } } catch (Exception ex) { logger.Log("Fatal", ex.Source, ex.TargetSite.ToString(), ex.Message, ex.StackTrace); } finally { } return(oresponse); }
public ActionResult UpdateUser(Int64 UserID) { UsersDO item = _usersDataAccess.ViewUserByID(UserID); UsersPO UserToUpdate = UsersMap1.UsersDOtoUsersPO(item); return(View(UserToUpdate)); }
// GET: Users public ActionResult ViewUsers() { List <UsersDO> allUsers = _usersDataAccess.ViewUsers(); List <UsersPO> mappedUsers = new List <UsersPO>(); try { foreach (UsersDO dataObject in allUsers) { mappedUsers.Add(UsersMap1.UsersDOtoUsersPO(dataObject)); } } catch (Exception ex) { logger.Log("Fatal", ex.Source, ex.TargetSite.ToString(), ex.Message, ex.StackTrace); } finally { } return(View(mappedUsers)); }
public ActionResult Login(LoginPO form) { ActionResult oreponse = null; try { if (ModelState.IsValid) { UsersPO login = UsersMap1.UsersDOtoUsersPO(_usersDataAccess.ViewByUserName(form.UserName)); if (login != null && login.Password.Trim() == form.Password.Trim()) { Session["UserID"] = login.UserID; Session["UserName"] = login.UserName; Session["Password"] = login.Password; Session["RoleID"] = login.RoleID; Session.Timeout = 10; oreponse = RedirectToAction("Index", "Home"); } else { oreponse = View(form); } } else { oreponse = View(form); } } catch (Exception ex) { logger.Log("Fatal", ex.Source, ex.TargetSite.ToString(), ex.Message, ex.StackTrace); } finally { } return(oreponse); }