// GET: Admin/Distributor/User/Id public ActionResult ManagemerchantUsers(string merchantid, string UserId = "") { var UserType = Session["UserType"].ToString(); string merchant_id = ""; merchant_id = merchantid.DecryptParameter(); MerchantUserCommon DMC = new MerchantUserCommon(); var user_id = UserId.DecryptParameter(); if (string.IsNullOrEmpty(merchant_id)) { return(RedirectToAction("Index")); } if (!string.IsNullOrEmpty(UserId)) { if (string.IsNullOrEmpty(user_id)) { return(RedirectToAction("ViewMerchantUser", new { merchantid = merchantid.EncryptParameter() })); } string username = ApplicationUtilities.GetSessionValue("username").ToString(); DMC = _merchant.GetUserById(merchant_id, user_id, username); DMC.UserId = user_id.EncryptParameter(); } DMC.MerchantId = merchant_id.EncryptParameter(); MerchantUserModel DMM = DMC.MapObject <MerchantUserModel>(); //LoadDropDownList(DMM); return(View(DMM)); }
public ActionResult ManagemerchantUsers(MerchantUserModel DMM) { MerchantUserCommon DMC = new MerchantUserCommon(); DMC = DMM.MapObject <MerchantUserCommon>(); if (!string.IsNullOrEmpty(DMC.UserId)) { ModelState.Remove("Password"); ModelState.Remove("ConfirmPassword"); ModelState.Remove("username"); } if (ModelState.IsValid) { if (!string.IsNullOrEmpty(DMC.UserId)) { DMC.UserId = DMC.UserId.DecryptParameter(); } if (!string.IsNullOrEmpty(DMC.MerchantId)) { DMC.MerchantId = DMC.MerchantId.DecryptParameter(); } DMC.ActionUser = ApplicationUtilities.GetSessionValue("username").ToString(); DMC.IpAddress = ApplicationUtilities.GetIP(); CommonDbResponse dbresp = _merchant.ManageUser(DMC); if (dbresp.Code == shared.Models.ResponseCode.Success) { this.ShowPopup(0, "Save Succesfully"); return(RedirectToAction("ViewMerchantUser", new { merchantid = DMC.MerchantId.EncryptParameter() })); } DMC.Msg = dbresp.Message; } this.ShowPopup(1, "Save unsuccessful!" + DMC.Msg); return(View(DMM)); }