/// <summary> /// Logins the specified user. /// </summary> /// <param name="user">The user.</param> /// <returns></returns> public Task <Response <User> > Login(User user) { return(ApplicationUtil.Try(async() => { await this.userService.Login(user); return user; })); }
/// <summary> /// Sends the recovery. /// </summary> /// <param name="email">The email.</param> /// <returns></returns> public Task <Response <bool> > SendRecovery(string email, string uri) { return(ApplicationUtil.Try(async() => { var user = await this.userService.GetUserWithRecoveryToken(email); await this.userService.SendRecoveryEmail(user, uri); return true; })); }
/// <summary> /// Updates the password. /// </summary> /// <param name="user">The user.</param> /// <returns></returns> public Task <Response <User> > UpdatePassword(User user, string uri) { return(ApplicationUtil.Try(async() => { var currentUser = await this.userService.CheckRecoveryToken(user); currentUser.Password = user.Password; await this.userService.Update(currentUser); currentUser.Password = string.Empty; await this.userService.SendUpdatePasswordEmail(user, uri); return currentUser; })); }
/// <summary> /// Gets all with relations. /// </summary> /// <param name="pageIndex">Index of the page.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="sortBy">The sort by.</param> /// <param name="direction">The direction.</param> /// <returns></returns> public Task<Response<Paginated<Infirmary>>> GetAllWithRelations(int pageIndex, int pageSize, string sortBy, string direction) { return ApplicationUtil.Try(async () => await this.infirmaryService.GetAllWithRelations(pageIndex, pageSize, sortBy, direction)); }
/// <summary> /// Gets the with relations. /// </summary> /// <param name="id">The identifier.</param> /// <returns></returns> public Task<Response<Infirmary>> GetWithRelations(string id) { return ApplicationUtil.Try(async () => await this.infirmaryService.GetWithRelations(id)); }
/// <summary> /// Checks the recovery token. /// </summary> /// <param name="user">The user.</param> /// <returns></returns> public Task <Response <User> > CheckRecoveryToken(User user) { return(ApplicationUtil.Try(() => this.userService.CheckRecoveryToken(user))); }