public static int AddGroupMeeting(GroupMeeting groupMeeting) { int rowAffected = 0; using (IDbConnection con = new SqlConnection(strConnectionString)) { if (con.State == ConnectionState.Closed) { con.Open(); } DynamicParameters parameters = new DynamicParameters(); parameters.Add("@ProjectName", groupMeeting.ProjectName); parameters.Add("@GroupMeetingLeadName", groupMeeting.GroupMeetingLeadName); parameters.Add("@TeamLeadName", groupMeeting.TeamLeadName); parameters.Add("@Description", groupMeeting.Description); parameters.Add("@GroupMeetingDate", groupMeeting.GroupMeetingDate); rowAffected = con.Execute("InsertGroupMeeting", parameters, commandType: CommandType.StoredProcedure); } return(rowAffected); }
public static GroupMeeting GetGroupMeetingById(int?id) { GroupMeeting groupMeeting = new GroupMeeting(); if (id == null) { return(groupMeeting); } using (IDbConnection con = new SqlConnection(strConnectionString)) { if (con.State == ConnectionState.Closed) { con.Open(); } DynamicParameters parameter = new DynamicParameters(); parameter.Add("@Id", id); groupMeeting = con.Query <GroupMeeting>("GetGroupMeetingByID", parameter, commandType: CommandType.StoredProcedure).FirstOrDefault(); } return(groupMeeting); }