private LesseeRest GetLesseeByAutoRegister(AutoRegisterRest user) { return(new LesseeRest { Contracts = new List <ContractRest>(), Id = 0, Password = user.Password, User = user.User }); }
private OwnerRest GetOwnerByAutoRegister(AutoRegisterRest user) { return(new OwnerRest { Contracts = new List <ContractRest>(), Id = 0, Password = user.Password, Properties = new List <PropertyRest>(), User = user.User }); }
public async Task <IActionResult> AutoRegisterApp(AutoRegisterRest user) { var response = await _acoountApplication.SaveUser(user); if (response == null) { return(BadRequest()); } return(Ok(response)); }
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); }
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 }); } }