示例#1
0
        protected void btnAdminSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    string opertaion = string.Empty;

                    master.IsSessionAvailable();
                    var service = CommonMethods.GetLogedInService();

                    var details = new BKIC.SellingPoint.DTO.RequestResponseWrappers.AdminRegister
                    {
                        UserName     = txtAdUserName.Text.ToString(),
                        Password     = txtAdPassword.Text.ToString(),
                        EmailAddress = txtAdEmail.Text.ToString()
                    };

                    opertaion = (sender as Button).Text;
                    //if (opertaion == "Update")
                    //{
                    //    details.Id = Convert.ToInt32(ViewState["UserId"].ToString());
                    //    details.Type = "edit";
                    //}
                    //else
                    //{
                    //    details.Type = "insert";
                    //}

                    var results = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                                    <BKIC.SellingPoint.DTO.RequestResponseWrappers.PostAdminUserResult>,
                                                    BKIC.SellingPoint.DTO.RequestResponseWrappers.AdminRegister>
                                      (BKIC.SellingPoint.DTO.Constants.UserURI.RegisterAdminUser, details);
                    if (results.StatusCode == 200 && results.Result.IsTransactionDone)
                    {
                        //LoadUserData();
                        ClearAdminControl();
                        userdetails.Visible  = true;
                        admindetails.Visible = false;
                        //btnSubmit.Text = (branchdetails.Type == "edit") ? "Save" : "Update";
                    }
                }
            }
            catch (Exception ex)
            {
                //throw ex;
            }
            finally
            {
                master.ShowLoading = false;
            }
        }
示例#2
0
 //[ApiAuthorize]
 public RR.PostAdminUserResult RegisterAdminUser(RR.AdminRegister admindetails)
 {
     try
     {
         BLO.AdminRegister       details = _mapper.Map <RR.AdminRegister, BLO.AdminRegister>(admindetails);
         BLO.PostAdminUserResult result  = _userRepository.PostAdminUser(details);
         return(_mapper.Map <BLO.PostAdminUserResult, RR.PostAdminUserResult>(result));
     }
     catch (Exception ex)
     {
         return(new RR.PostAdminUserResult
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }