コード例 #1
0
        bool INewsletterHelper.TrySave(Models.Home.NewsletterModel model)
        {
            string mail = model.Email;
            int selectedId = model.selectedTypeOfNews;
            var currentTime = DateTime.Now;

            var modelToSave = new Newsletter()
            {
                email = mail,
                TypeOfNewsId = selectedId,
                InsertTime = currentTime
            };

            _newsletterRepository.Add(modelToSave);

            return true;
        }
コード例 #2
0
 void INewsletterRepository.Add(Newsletter news)
 {
     context.Newsletter.Add(news);
     context.SaveChanges();
 }