Пример #1
0
        public async Task <bool> AddRecord(contactus submission)
        {
            dbContext.contactus.Add(submission);
            var success = await dbContext.SaveChangesAsync();

            return(success > 0 ? true : false);
        }
        public async Task <bool> AddComment(blog_comment comment)
        {
            dbContext.blog_comment.Add(comment);
            var success = await dbContext.SaveChangesAsync();

            return(success > 0 ? true : false);
        }
Пример #3
0
        public async Task <blog_user> AddUser(blog_user user)
        {
            var _existingUser = await dbContext.blog_user.Where(x => x.Email == user.Email).FirstOrDefaultAsync();

            if (_existingUser != null)
            {
                return(_existingUser);
            }
            else
            {
                user.Avatar = Constants.GRAVATAR_BASE_URL + await util.GetHashedValue(user.Email);

                var _newUser = dbContext.blog_user.Add(user);
                var success  = await dbContext.SaveChangesAsync();

                if (success > 0)
                {
                    return(_newUser);
                }
                else
                {
                    return(null);
                }
            }
        }
Пример #4
0
        public async Task <string> AddSubscriber(newsletter_sub subscriber)
        {
            var _existingsub = await dbContext.newsletter_sub.Where(x => x.Email == subscriber.Email).FirstOrDefaultAsync();

            if (_existingsub != null)
            {
                return(Constants.NEWSLETTER_EXIST_MSG);
            }
            else
            {
                subscriber.IsSubscribed = true;
                var _newSub = dbContext.newsletter_sub.Add(subscriber);
                var success = await dbContext.SaveChangesAsync();

                if (success > 0)
                {
                    return(Constants.NEWSLETTER_THANK_MSG);
                }
                else
                {
                    return(Constants.NEWSLETTER_FAIL_MSG);
                }
            }
        }