public virtual PollStore UpdatePollStore(PollStore entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            PollStore other = GetPollStore(entity.PollId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update PollStore set  [ID]=@ID
							, [StoreID]=@StoreID
							, [CreatedOn]=@CreatedOn 
							 where PollID=@PollID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@PollID", entity.PollId)
                , new SqlParameter("@ID", entity.Id)
                , new SqlParameter("@StoreID", entity.StoreId)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetPollStore(entity.PollId));
        }
        public virtual PollStore InsertPollStore(PollStore entity)
        {
            PollStore other = new PollStore();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into PollStore ( [PollID]
				,[ID]
				,[StoreID]
				,[CreatedOn] )
				Values
				( @PollID
				, @ID
				, @StoreID
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@PollID", entity.PollId)
                    , new SqlParameter("@ID", entity.Id)
                    , new SqlParameter("@StoreID", entity.StoreId)
                    , new SqlParameter("@CreatedOn", entity.CreatedOn)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetPollStore(Convert.ToInt32(identity)));
            }
            return(entity);
        }
        public virtual PollStore PollStoreFromDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            PollStore entity = new PollStore();

            entity.Id        = (System.Int32)dr["ID"];
            entity.PollId    = (System.Int32)dr["PollID"];
            entity.StoreId   = (System.Int32)dr["StoreID"];
            entity.CreatedOn = (System.DateTime)dr["CreatedOn"];
            return(entity);
        }
 public PollStore InsertPollStore(PollStore entity)
 {
     return(_iPollStoreRepository.InsertPollStore(entity));
 }
 public PollStore UpdatePollStore(PollStore entity)
 {
     return(_iPollStoreRepository.UpdatePollStore(entity));
 }
 public virtual PollStore DeletePollStore(PollStore entity)
 {
     this.DeletePollStore(entity.PollId);
     return(entity);
 }