Exemple #1
0
        public void Update(HelpViewModel model)
        {
            var item = db.Helps.SingleOrDefault(x => x.Id == model.Id);

            item.OrderId     = model.OrderId;
            item.Hashtag     = model.Hashtag;
            item.HelpGroupId = model.HelpGroupId;
            item.TitleRu     = model.TitleRu;
            item.TitleUa     = model.TitleUa;
            item.TitleEn     = model.TitleEn;
            item.Ru          = model.Ru;
            item.Ua          = model.Ua;
            item.En          = model.En;
            item.UpdateDate  = DateTime.Now;

            db.SaveChanges();
            StaticData.Inst.ReloadFAQ();
        }
Exemple #2
0
        public void Create(HelpViewModel model)
        {
            if (db.Helps.Any(x => x.Hashtag == model.Hashtag.ToLower()))
            {
                throw new Exception(string.Format("Хештег {0} уже существует в базе.", model.Hashtag));
            }

            var item = db.Helps.Create();

            item.OrderId     = model.OrderId;
            item.Hashtag     = model.Hashtag;
            item.HelpGroupId = model.HelpGroupId;
            item.TitleRu     = model.TitleRu;
            item.TitleUa     = model.TitleUa;
            item.TitleEn     = model.TitleEn;
            item.Ru          = model.Ru;
            item.Ua          = model.Ua;
            item.En          = model.En;
            item.UpdateDate  = DateTime.UtcNow;

            db.Helps.Add(item);
            db.SaveChanges();
            StaticData.Inst.ReloadFAQ();
        }