public virtual PollCategory InsertPollCategory(PollCategory entity) { PollCategory other = new PollCategory(); other = entity; if (entity.IsTransient()) { string sql = @"Insert into PollCategory ( [PollID] ,[CategoryID] ,[CreatedOn] ) Values ( @PollID , @CategoryID , @CreatedOn ); Select scope_identity()" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@PollID", entity.PollId) , new SqlParameter("@CategoryID", entity.CategoryId) , 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(GetPollCategory(Convert.ToInt32(identity))); } return(entity); }
public virtual PollCategory PollCategoryFromDataRow(DataRow dr) { if (dr == null) { return(null); } PollCategory entity = new PollCategory(); entity.PollId = (System.Int32)dr["PollID"]; entity.CategoryId = (System.Int32)dr["CategoryID"]; entity.CreatedOn = (System.DateTime)dr["CreatedOn"]; return(entity); }
public virtual PollCategory UpdatePollCategory(PollCategory entity) { if (entity.IsTransient()) { return(entity); } PollCategory other = GetPollCategory(entity.PollId); if (entity.Equals(other)) { return(entity); } string sql = @"Update PollCategory set [CategoryID]=@CategoryID , [CreatedOn]=@CreatedOn where PollID=@PollID" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@PollID", entity.PollId) , new SqlParameter("@CategoryID", entity.CategoryId) , new SqlParameter("@CreatedOn", entity.CreatedOn) }; SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray); return(GetPollCategory(entity.PollId)); }
public virtual PollCategory DeletePollCategory(PollCategory entity) { this.DeletePollCategory(entity.PollId); return(entity); }
public PollCategory InsertPollCategory(PollCategory entity) { return(_iPollCategoryRepository.InsertPollCategory(entity)); }
public PollCategory UpdatePollCategory(PollCategory entity) { return(_iPollCategoryRepository.UpdatePollCategory(entity)); }