コード例 #1
0
 public virtual void Update(T entity)
 {
     using (RentaCarContext context = new RentaCarContext())
     {
         var deleteEntity = context.Entry(entity);
         deleteEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
コード例 #2
0
 public List <T> GetAll(Expression <Func <T, bool> > filter = null)
 {
     using (RentaCarContext context = new RentaCarContext())
     {
         return(filter == null?
                context.Set <T>().ToList() :
                    context.Set <T>().Where(filter).ToList());
     }
 }
コード例 #3
0
 public virtual void Add(T entity)
 {
     using (RentaCarContext context = new RentaCarContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }
コード例 #4
0
        private bool CheckId(int id)
        {
            RentaCarContext context = new RentaCarContext();
            var             result  = context.UserFindex.Where(u => u.UserId == id).Any();

            if (result)
            {
                return(false);
            }
            return(true);
        }
コード例 #5
0
        private bool CheckColorId(int id)
        {
            RentaCarContext context = new RentaCarContext();

            var result = context.Colors.Where(c => c.ColorId == id).Any();

            if (result)
            {
                return(false);
            }

            return(true);
        }
コード例 #6
0
        private bool CheckBrandId(int id)
        {
            RentaCarContext context = new RentaCarContext();

            var check = context.Brands.Where(b => b.BrandId == id).Any();

            if (check)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
コード例 #7
0
 public BaseService(RentaCarContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
コード例 #8
0
 public static void Seed(RentaCarContext context)
 {
     context.Database.EnsureCreated();
 }
 public CustomerService(RentaCarContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
コード例 #10
0
 public VehicleModelService(RentaCarContext context, IMapper mapper) : base(context, mapper)
 {
 }
コード例 #11
0
 public BranchService(RentaCarContext context, IMapper mapper) : base(context, mapper)
 {
 }
コード例 #12
0
ファイル: UnitofWork.cs プロジェクト: haliltokszz/RentaCar
 public UnitofWork()
 {
     _context = new RentaCarContext();
 }
コード例 #13
0
 public BaseCRUDService(RentaCarContext context, IMapper mapper) : base(context, mapper)
 {
 }
 public ManufacturerService(RentaCarContext context, IMapper mapper) : base(context, mapper)
 {
 }
コード例 #15
0
 public RatingService(RentaCarContext context, IMapper mapper) : base(context, mapper)
 {
 }
コード例 #16
0
 public CommentService(RentaCarContext context, IMapper mapper) : base(context, mapper)
 {
 }
 public RecommendService(RentaCarContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }