public ActionResult ManageAgentUser(AgentUserModel dcommon) { if (!string.IsNullOrEmpty(dcommon.UserID)) { ModelState.Remove("Password"); ModelState.Remove("ConfirmPassword"); ModelState.Remove("UserEmail"); ModelState.Remove("UserMobileNumber"); ModelState.Remove("UserName"); } if (ModelState.IsValid) { if (!string.IsNullOrEmpty(dcommon.UserID)) { dcommon.UserID = dcommon.UserID.DecryptParameter(); } if (!string.IsNullOrEmpty(dcommon.AgentID)) { dcommon.AgentID = dcommon.AgentID.DecryptParameter(); } AgentManagementCommon amcommon = new AgentManagementCommon(); amcommon = dcommon.MapObject <AgentManagementCommon>(); amcommon.ActionUser = ApplicationUtilities.GetSessionValue("username").ToString(); amcommon.IpAddress = ApplicationUtilities.GetIP(); CommonDbResponse dbresp = buss.ManageAgentUser(amcommon); if (dbresp.Code == shared.Models.ResponseCode.Success) { this.ShowPopup(0, "Save Succesfully"); return(RedirectToAction("ViewAgentUser", new { AgentId = dcommon.AgentID.EncryptParameter() })); } } this.ShowPopup(1, "Save unsuccessful.Please try again!"); return(View(dcommon)); }
public ActionResult ManageAgentUser(string AgentId, string UserId = "") { AgentUserModel Agentmodel = new AgentUserModel(); var Agent_id = AgentId.DecryptParameter(); var user_id = UserId.DecryptParameter(); if (string.IsNullOrEmpty(Agent_id)) { return(RedirectToAction("Index")); } if (!string.IsNullOrEmpty(UserId)) { if (string.IsNullOrEmpty(user_id)) { return(RedirectToAction("ViewAgentUser", new { AgentId = AgentId })); } AgentManagementCommon amc = new AgentManagementCommon(); amc.AgentID = Agent_id; amc.ActionUser = Session["UserName"].ToString(); amc.UserID = user_id; var agentUserList = buss.GetUserList(amc);//.FirstOrDefault(); if (agentUserList.Count > 0) { var agentm = agentUserList.FirstOrDefault(); Agentmodel.UserID = agentm.UserID.EncryptParameter(); Agentmodel.FullName = agentm.FullName; Agentmodel.UserEmail = agentm.UserEmail; Agentmodel.UserMobileNumber = agentm.UserMobileNumber; Agentmodel.UserStatus = agentm.UserStatus; Agentmodel.UserName = agentm.UserName; } else { ApplicationUtilities.ShowPopup(this, 1, "User Not Found!"); return(RedirectToAction("ViewAgentUser", new { AgentId = AgentId })); } } Agentmodel.AgentID = AgentId; return(View(Agentmodel)); }