示例#1
0
        public void Delete(int costType, int marketingYearId)
        {
            using (var db = new DbContext())
            {
                Entities.CostPlan costPlan = db.CostPlan.Single(x => x.MarketingYearId == marketingYearId && x.Type == costType);

                db.CostPlan.Remove(costPlan);
                db.SaveChanges();
            }
        }
示例#2
0
        public void Update(CostPlanDto dto)
        {
            using (var db = new DbContext())
            {
                Entities.CostPlan costPlan = db.CostPlan.Single(x => x.MarketingYearId == dto.MarketingYearId && x.Type == dto.Type);

                costPlan.Cost = dto.Cost;

                db.SaveChanges();
            }
        }
示例#3
0
        public void Insert(CostPlanDto dto)
        {
            var entity = new Entities.CostPlan
            {
                Type            = dto.Type,
                Cost            = dto.Cost,
                MarketingYearId = dto.MarketingYearId
            };

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