Exemplo n.º 1
0
 /// <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;
     }));
 }
Exemplo n.º 2
0
 /// <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;
     }));
 }
Exemplo n.º 3
0
 /// <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;
     }));
 }
Exemplo n.º 4
0
 /// <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));
 }
Exemplo n.º 5
0
 /// <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));
 }
Exemplo n.º 6
0
 /// <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)));
 }