public void editSubscribedUser(Subscribed_UserEntity userEntity)
 {
     subscribed_user user = Decorator.getSubscribedUser(userEntity);
      user.UpdatedDate = DateTime.Now;
      db.Entry(user).State = EntityState.Modified;
      db.SaveChanges();
 }
        // POST: api/User
        public string Post(User userDeatails )
        {
            try
            {

                // TODO: Add insert logic here
                var allblogType = blogTyperepo.GetAll();
                string str = "";
                foreach(var obj in allblogType ){
                    if (str != "")
                        str = str + ",";
                    str = str + obj.Id;

                }
                Subscribed_UserEntity user = new Subscribed_UserEntity();
                user.User_Name = userDeatails.UserName;
                user.User_Email = userDeatails.UserEmail;
                user.BlogTypeId = str;
                user.IsDeleted = false;
                user.CreatedDate = DateTime.Now;
                repo.Add(user);
                return "success";

            }
            catch
            {
                return "failed";
            }
        }
        public Subscribed_UserEntity Add(Subscribed_UserEntity item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            userObject.createSubscribedUser(item);
            return item;
        }
        public bool Update(Subscribed_UserEntity item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            // TO DO : Code to update record into database
            userObject.editSubscribedUser(item);
            return true;
        }
 public void createSubscribedUser(Subscribed_UserEntity userEntity)
 {
     var temp = db.subscribed_user.Where(subuser => subuser.User_Email == userEntity.User_Email).FirstOrDefault();
      if (temp == null)
      {
          subscribed_user user = Decorator.getSubscribedUser(userEntity);
          user.CreatedDate = DateTime.Now;
          user.UpdatedDate = DateTime.Now;
          user.IsDeleted = false;
          db.subscribed_user.Add(user);
          db.SaveChanges();
      }
 }
 public void editSubscribedUser(Subscribed_UserEntity userEntity)
 {
     userObj.editSubscribedUser(userEntity);
 }
 public void createSubscribedUser(Subscribed_UserEntity userEntity)
 {
     userObj.createSubscribedUser(userEntity);
 }
        public static Subscribed_UserEntity getSubscribedUserEntity(subscribed_user subscribedObj)
        {
            Subscribed_UserEntity subscribedType = new Subscribed_UserEntity();
            subscribedType.Id = subscribedObj.Id;
            subscribedType.User_Name = subscribedObj.User_Name;
            subscribedType.User_Email = subscribedObj.User_Email;
            subscribedType.BlogTypeId = subscribedObj.BlogTypeId;
            subscribedType.CreatedDate = subscribedObj.CreatedDate;
            subscribedType.User_Address = subscribedObj.User_Address;
            subscribedType.User_Contact = subscribedObj.User_Contact;
            subscribedType.UpdatedDate = subscribedObj.UpdatedDate;
            subscribedType.IsDeleted = subscribedObj.IsDeleted;

            return subscribedType;
        }