コード例 #1
0
        public static async Task <Sponsor> GetOrCreateSponsorAsync(this MasterSideLetterDataAccess dataAccess, string name)
        {
            var existing = await dataAccess.GetSponsorByNameAsync(name);

            if (existing != null)
            {
                return(existing);
            }
            var newSponsor = new Sponsor {
                Name = name
            };

            newSponsor.Id = await dataAccess.CreateSponsorAsync(newSponsor);

            return(newSponsor);
        }