Beispiel #1
0
        public int Add(DealModel model)
        {
            var deal = new Deal
            {
                Title  = model.Title,
                Image  = model.DealImage,
                Active = model.Active
            };

            db.Deals.Add(deal);
            return(db.SaveChanges());
        }
Beispiel #2
0
        public int Update(DealModel model)
        {
            var deal = db.Deals.FirstOrDefault(m => m.DealId == model.DealId);

            if (deal != null)
            {
                deal.Title  = model.Title;
                deal.Active = model.Active;
                deal.Image  = model.DealImage;
                return(db.SaveChanges());
            }

            return(0);
        }