Ejemplo n.º 1
0
 public async Task <UserInfoDto> ValidateUser(string username, string password)
 {
     try
     {
         using (AguilaContext _context = new AguilaContext())
         {
             var users = await(from user in _context.AspNetUsers
                               join roles in _context.AspNetUserRoles on user.Id equals roles.UserId
                               join roleType in _context.AspNetRoles on roles.RoleId equals roleType.Id
                               where user.UserName == username && user.PasswordHash == password
                               select new UserInfoDto
             {
                 UserId   = user.Id,
                 UserName = user.UserName,
                 Name     = user.Name,
                 Role     = roleType.Name
             }).FirstOrDefaultAsync();
             return(users);
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
Ejemplo n.º 2
0
 public UserService(IMapper mapper
                    , ILoggerFactory loggerFactory
                    , AguilaContext aguilaContext
                    , RoleManager <ApplicationRoleDto> roleManager
                    , UserManager <ApplicationUserDto> userManager
                    , SignInManager <ApplicationUserDto> signInManager
                    , IOptions <IdentityCookieOptions> identityCookieOptions
                    , ISendEmailService sendEmailService
                    )
 {
     _mapper               = mapper;
     _userManager          = userManager;
     _roleManager          = roleManager;
     _signInManager        = signInManager;
     _aguilaContext        = aguilaContext;
     _externalCookieScheme = identityCookieOptions.Value.ExternalCookieAuthenticationScheme;
     _sendEmailService     = sendEmailService;
 }
Ejemplo n.º 3
0
        //code by sohan   Service

        public async Task <IEnumerable <SituationsDto> > GetSituationsByNextHoleId(int Id)
        {
            using (AguilaContext _context = new AguilaContext())
            {
                _context.Database.OpenConnection();
                DbCommand cmd = _context.Database.GetDbConnection().CreateCommand();
                cmd.CommandText = "USP_getSituationsNextHole";
                DbParameter param1 = cmd.CreateParameter();
                param1.ParameterName = "@ID";
                param1.Value         = Id;
                cmd.Parameters.Add(param1);
                cmd.CommandType = CommandType.StoredProcedure;
                List <SituationsDto> IistSituation;
                using (var reader = cmd.ExecuteReader())
                {
                    IistSituation = reader.MapToList <SituationsDto>();
                }
                if (IistSituation != null)
                {
                    IQueryable <Situations> situations = _context.Situations
                                                         .Include(x => x.SituationHandicaps)
                                                         .Include(x => x.SituationAttributes)
                                                         .Include(x => x.SituationQuestions).ThenInclude(situation => situation.Answers)
                                                         .Include(x => x.SituationCategory)
                                                         .Where(x => x.Deleted == false);
                    var result1 = situations.Where(x => IistSituation.Any(y => y.Id == x.Id));
                    var data    = await result1.ToListAsync();

                    IEnumerable <SituationsDto> result = _mapper.Map <IEnumerable <Situations>, IEnumerable <SituationsDto> >(data);
                    return(result);
                }
                else
                {
                    return(null);
                }
            }
        }
Ejemplo n.º 4
0
 public AccountService(IMapper mapper
                       , AguilaContext aguilaContext
                       , ILoggerFactory loggerFactory
                       , IConfiguration configuration
                       , IHostingEnvironment hostingEnv
                       , RoleManager <ApplicationRoleDto> roleManager
                       , UserManager <ApplicationUserDto> userManager
                       , IHttpContextAccessor httpContextAccessor
                       , SignInManager <ApplicationUserDto> signInManager
                       , IOptions <IdentityCookieOptions> identityCookieOptions
                       , IPasswordHasher <ApplicationUserDto> passwordHasher
                       )
 {
     _mapper                   = mapper;
     _hostingEnv               = hostingEnv;
     _userManager              = userManager;
     _roleManager              = roleManager;
     _signInManager            = signInManager;
     _aguilaContext            = aguilaContext;
     _configuration            = configuration;
     this._httpContextAccessor = httpContextAccessor;
     _externalCookieScheme     = identityCookieOptions.Value.ExternalCookieAuthenticationScheme;
     _passwordHasher           = passwordHasher;
 }
Ejemplo n.º 5
0
 public RoundService(AguilaContext entities)
 {
     this._entities = entities;
 }
Ejemplo n.º 6
0
 public SituationService(AguilaContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Ejemplo n.º 7
0
 public LRDService(AguilaContext entities, IUnitOfWork repo, IMapper mapper)
 {
     this._entities = entities;
     this._mapper   = mapper;
     this._repo     = repo;
 }
Ejemplo n.º 8
0
 public AttributeService(IUnitOfWork repo, IMapper mapper, AguilaContext context)
 {
     this._repo    = repo;
     this._mapper  = mapper;
     this._context = context;
 }
Ejemplo n.º 9
0
 public PictureBookService(IUnitOfWork repo, IMapper mapper, AguilaContext context)
 {
     this._context = context;
     this._repo    = repo;
     this._mapper  = mapper;
 }
Ejemplo n.º 10
0
 public UnitOfWork(AguilaContext dbContext)
 {
     entities = dbContext;
 }
Ejemplo n.º 11
0
 public ValuesController(AguilaContext _answerServices)
 {
     answerServices = _answerServices;
 }
Ejemplo n.º 12
0
 public Repository(AguilaContext _entities)
 {
     entities = _entities;
 }