public short CreateGroup(Group_ group) { const string query = @" insert into [mon].[Group] ([Name], [IsDefault], [Description]) values (@Name, @IsDefault, @Description) ;select SCOPE_IDENTITY() id "; using (var con = Connection) { return(con.ExecuteScalar <short>(query, group)); } }
public short CreateGroup(Group_ group) { const string query = @" insert into mon.""Group"" (""Name"", ""IsDefault"", ""Description"") values (@Name, @IsDefault, @Description) returning ""ID"" "; using (var con = Connection) { return(con.ExecuteScalar <short>(query, group)); } }
public Group CreateGroup(Group_ group) { var newId = _repository.CreateGroup(group); var newGroup = new Group { ID = newId, Name = group.Name, Description = group.Description, IsDefault = group.IsDefault, Instances = new List <int>() }; _groups.Add(newGroup.ID, newGroup); return(newGroup); }