Exemplo n.º 1
0
        public void Delete(int huntEquipmentType, int marketingYearId)
        {
            using (var db = new DbContext())
            {
                Entities.HuntEquipmentPlan huntEquipmentPlan = db.HuntEquipmentPlan.Single(x => x.MarketingYearId == marketingYearId && x.Type == huntEquipmentType);

                db.HuntEquipmentPlan.Remove(huntEquipmentPlan);
                db.SaveChanges();
            }
        }
Exemplo n.º 2
0
        public void Update(HuntEquipmentPlanDto dto)
        {
            using (var db = new DbContext())
            {
                Entities.HuntEquipmentPlan huntEquipmentPlan = db.HuntEquipmentPlan.Single(x => x.MarketingYearId == dto.MarketingYearId && x.Type == dto.Type);

                huntEquipmentPlan.Count = dto.Count;

                db.SaveChanges();
            }
        }
Exemplo n.º 3
0
        public void Insert(HuntEquipmentPlanDto dto)
        {
            var entity = new Entities.HuntEquipmentPlan
            {
                Type            = dto.Type,
                Count           = dto.Count,
                MarketingYearId = dto.MarketingYearId
            };

            using (var db = new DbContext())
            {
                db.HuntEquipmentPlan.Add(entity);
                db.SaveChanges();
            }
        }