コード例 #1
0
 public TruckLogicRepository(AutomobileContext context, IMapper mapper)
 {
     _context = context ??
                throw new ArgumentNullException(nameof(AutomobileContext));
     _mapper = mapper ??
               throw new ArgumentNullException(nameof(mapper));
 }
コード例 #2
0
 public TruckController(ITruckLogicRepository logicRepository, IMapper mapper, AutomobileContext context)
 {
     _logicRepository = logicRepository ??
                        throw new ArgumentNullException(nameof(logicRepository));
     _context = context ??
                throw new ArgumentNullException(nameof(AutomobileContext));
 }
コード例 #3
0
 public UserController(/*ITruckLogicRepository logicRepository*/ AutomobileContext context, IMapper mapper)
 {
     //_logicRepository = logicRepository ??
     //    throw new ArgumentNullException(nameof(logicRepository));
     _context = context ??
                throw new ArgumentNullException(nameof(AutomobileContext));
     _mapper = mapper;
 }
コード例 #4
0
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            var db = new AutomobileContext();


            var user = (UserAuthentication)validationContext.ObjectInstance;

            if (db.Database.ExecuteSqlRaw($"select Email from avto.Users where Email='{user.Email}'") != 0)
            {
                return(new ValidationResult($"The e-mail {user.Email} is already exist..",
                                            new[] { nameof(UserAuthentication) }));
            }
            //if (db.Users.Any(u=>u.Email==user.Email))
            //{
            //    return new ValidationResult($"The e-mail {user.Email} is already exist..",
            //                    new[] {nameof(UserAuthentication)});
            //}

            return(ValidationResult.Success);
        }
コード例 #5
0
 public ProjectRepository(AutomobileContext context)
 {
     _context = context;
 }
コード例 #6
0
 public CompanyRepository(AutomobileContext context)
 {
     _context = context;
 }
コード例 #7
0
 public CommentRepository(AutomobileContext context)
 {
     _context = context;
 }
コード例 #8
0
 public CarsController(AutomobileContext context)
 {
     _context = context;
 }
コード例 #9
0
 public UserRepository(AutomobileContext context)
 {
     _context = context;
 }
コード例 #10
0
 public BrandRepository(AutomobileContext context)
 {
     _context = context;
 }