public void CreateNewArtist()
        {
            var saveRequest = new Artist();
            {
                saveRequest.ArtistId = 15;
                saveRequest.Name = "David";
                saveRequest.UrlSafeName = "davidthompson";
            };

            var client = new RestClient(_baseUrl);
            var request = new RestRequest("artist", Method.POST) { RequestFormat = DataFormat.Json };

            var jsonSaveRequest = JsonConvert.SerializeObject(saveRequest);
            request.AddParameter("application/json; charset=utf-8", jsonSaveRequest, ParameterType.RequestBody);
            request.RequestFormat = DataFormat.Json;

            var response = client.Execute<Artist>(request);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                var results = response.Data;
                Assert.IsNotNull(results);
                Assert.IsNotNull(results.Name);
                Assert.AreEqual(results.Name, saveRequest.Name);
            }
            else if (response.StatusCode == HttpStatusCode.BadRequest)
            {
            }
            else
            {
                Assert.Fail();
            }
        }
        public IHttpActionResult Put(int id, Artist artist)
        {
            if (id != artist.ArtistId)
            {
                return BadRequest();
            }

            Artist oldArtist = _repo.GetArtist(id);
            if (oldArtist == null)
            {
                return NotFound();
            }

            _repo.Update(artist);

            return Ok(artist);
        }
        public bool Update(Artist artist)
        {
            try
            {
                var artistIdParam = new SqlParameter("@ArtistId", SqlDbType.Int) { Value = artist.ArtistId };
                var nameParam = new SqlParameter("@Name ", SqlDbType.VarChar) { Value = artist.Name };
                var urlSafeNameParam = new SqlParameter("@UrlSafeName ", SqlDbType.VarChar) { Value = artist.UrlSafeName };

                _musicContext.Database.ExecuteSqlCommand(
                   "dbo.UpdateArtist @ArtistId, @Name, @UrlSafeName",
                   artistIdParam, nameParam, urlSafeNameParam);

                return true;
            }
            catch
            {
                return false;
            }
        }
        public void UpdateArtist()
        {
            var Urequest = new Artist();
            {

                Urequest.ArtistId = 1;
                Urequest.Name = "Diana Smith";
                Urequest.UrlSafeName = "diana-smith";
            };

            var client = new RestClient(_baseUrl);
            var request = new RestRequest("artist/1", Method.PUT) { RequestFormat = DataFormat.Json };

            var jsonSaveRequest = JsonConvert.SerializeObject(Urequest);
            request.AddParameter("application/json; charset=utf-8", jsonSaveRequest, ParameterType.RequestBody);
            request.RequestFormat = DataFormat.Json;

            var response = client.Execute<Artist>(request);

            if (response.StatusCode == HttpStatusCode.Created)
            {
                var results = response.Data;
                Assert.IsNotNull(results);
                Assert.IsNotNull(results.Name);
                Assert.AreEqual(results.Name, Urequest.Name);
            }
            else if (response.StatusCode == HttpStatusCode.BadRequest)
            {
            }
            else
            {
                Assert.Fail();
            }
        }
 public IHttpActionResult Post(Artist artist)
 {
     _repo.Insert(artist);
     return Ok(artist);
 }