private async void SignUpClicked(object obj) { if (CheckValidation() == 0) { UserDTO userDTO = new UserDTO(); userDTO.Active = true; userDTO.Address = Address.Data; userDTO.DeviceId = ""; userDTO.Email = Email.Data; userDTO.Password = Password.Data; userDTO.StoreName = StoreName.Data; userDTO.StoreUserId = 1; userDTO.PhoneNo = PhoneNo.Data; userDTO.Username = Username.Data; RegisterStoreRequest registerStoreRequest = new RegisterStoreRequest(); registerStoreRequest.AuthToken = ""; registerStoreRequest.UserInfo = userDTO; registerStoreRequest.CategoryIDs = SaleItemGlobal.selectedCategories.Where(x => x.IsChecked == true).Select(x => x.CategoryId).ToList(); JsonValue userLoginResponse = await HttpRequestHelper <RegisterStoreRequest> .POSTreq(ServiceTypes.RegisterStore, registerStoreRequest); RegisterStoreResponse registerStoreResponse = JsonConvert.DeserializeObject <RegisterStoreResponse>(userLoginResponse.ToString()); if (registerStoreResponse.IsSuccess) { SaleItemGlobal.selectedCategories = new List <CategoryDTO>(); await App.Current.MainPage.DisplayAlert("Success", registerStoreResponse.Message, "Ok"); } else { await App.Current.MainPage.DisplayAlert("Error", registerStoreResponse.Message, "Ok"); } } }
public RegisterStoreResponse Register(RegisterStoreRequest request) { RegisterStoreResponse registerStoreResponse = new RegisterStoreResponse(); registerStoreResponse.Message = "Store not registered successfully."; if (String.IsNullOrEmpty(request.UserInfo.Username) || String.IsNullOrEmpty(request.UserInfo.Password) || String.IsNullOrEmpty(request.UserInfo.Email)) { registerStoreResponse.Message = "Please pass all mandatory fields."; return(registerStoreResponse); } if (new Helper().IsEmailExist(request.UserInfo.Email) || new Helper().IsUserNameExist(request.UserInfo.Username)) { registerStoreResponse.Message = "Username of Email already exist."; return(registerStoreResponse); } UserEL userEL = new UserEL(); userEL = MapperUtility.MapTo(request.UserInfo, userEL); if (userHelper.RegisterUser(userEL)) { registerStoreResponse.Message = "Registration successfully completed."; registerStoreResponse.IsLoggedIn = registerStoreResponse.IsSuccess = true; return(registerStoreResponse); } else { registerStoreResponse.Message = "Some error occured."; return(registerStoreResponse); } }