示例#1
0
 private LesseeRest GetLesseeByAutoRegister(AutoRegisterRest user)
 {
     return(new LesseeRest {
         Contracts = new List <ContractRest>(),
         Id = 0,
         Password = user.Password,
         User = user.User
     });
 }
示例#2
0
 private OwnerRest GetOwnerByAutoRegister(AutoRegisterRest user)
 {
     return(new OwnerRest {
         Contracts = new List <ContractRest>(),
         Id = 0,
         Password = user.Password,
         Properties = new List <PropertyRest>(),
         User = user.User
     });
 }
示例#3
0
        public async Task <IActionResult> AutoRegisterApp(AutoRegisterRest user)
        {
            var response = await _acoountApplication.SaveUser(user);

            if (response == null)
            {
                return(BadRequest());
            }
            return(Ok(response));
        }
示例#4
0
        public async Task <UserRest> SaveUser(AutoRegisterRest user)
        {
            UserRest userRest = null;

            if (user.Role.Equals(Helper.Constans.ROLE_OWNER))
            {
                var owner = await _ownerApplication.Save(GetOwnerByAutoRegister(user));

                userRest = owner.User;
            }
            else if (user.Role.Equals(Helper.Constans.ROLE_LESSEE))
            {
                var lessee = await _lesseeApplication.Save(GetLesseeByAutoRegister(user));

                userRest = lessee.User;
            }
            return(userRest);
        }
示例#5
0
        internal async Task <Response <UserRest> > RegisterUser(ViewModelBase viewModel, AutoRegisterRest autoregister)
        {
            try
            {
                var user = await RestService.For <IMyLeasingService>(viewModel.GetStringForDistionary(Constants.UrlApi)).CreateUser(autoregister);

                if (user == null)
                {
                    return(new Response <UserRest> {
                        IsSuccess = false, Message = "F Bro..."
                    });
                }
                return(new Response <UserRest> {
                    IsSuccess = true, Result = user
                });
            }
            catch (Exception ex)
            {
                return(new Response <UserRest> {
                    IsSuccess = false, Message = ex.Message
                });
            }
        }