Пример #1
0
        //Metod som lägger till en person
        public Task InsertPerson(Person person)
        {
            if (string.IsNullOrWhiteSpace(person.FirstName) || string.IsNullOrWhiteSpace(person.LastName) ||
                string.IsNullOrWhiteSpace(person.EmailAddress))
            {
                throw new Exception();
            }
            const string sql = @"insert into dbo.Person (FirstName, LastName, EmailAddress)" +
                               "values (@FirstName, @LastName, @EmailAddress)";

            return(_sqlDataAccess.ExecuteSqlAsync(sql, person));
        }