public GroupVm(IRecipientGroup recipientGroup) { this.ID = recipientGroup.ID; this.Name = recipientGroup.Name; this.Description = recipientGroup.Description; this.ChurchId = recipientGroup.ChurchId; }
/// <summary> /// Saves the group, returns the ID. /// </summary> /// <returns>The ID of the group (new if insert, same if update)</returns> public int SaveRecipientGroup(IRecipientGroup group) { var proc = "SaveMessageRecipientGroup"; var paramz = new List <SqlParameter>(); paramz.Add(new SqlParameter("id", group.Id)); paramz.Add(new SqlParameter("ChurchId", group.ChurchId)); paramz.Add(new SqlParameter("Name", group.Name)); paramz.Add(new SqlParameter("Desc", group.Description)); paramz.Add(new SqlParameter("MessageTypeEnumId", group.MessageTypeEnumID)); Func <SqlDataReader, int> readFx = (reader) => { return(reader.GetInt32(0)); // new id }; var list = this.executor.ExecuteSql <int>(proc, CommandType.StoredProcedure, paramz, readFx); return(list.First()); }