Example #1
0
        public async Task <ActionResult <ArtistDTO> > Put(int id, [FromBody] JObject model)
        {
            var valueProvider = new ObjectSourceValueProvider(model);

            var existing = context.Artists.FirstOrDefault(p => p.Id == id);

            if (existing != null && ModelState.IsValid && await TryUpdateModelAsync(existing, "", valueProvider))
            {
                this.context.SaveChanges();
                return(Get(id));
            }

            if (existing == null)
            {
                ModelState.AddModelError("id", "Invalid client ID");
            }

            return(BadRequest(ModelState));
        }
Example #2
0
 private Task <bool> TryUpdateModelAsync(Song existing, string v, ObjectSourceValueProvider valueProvider)
 {
     throw new NotImplementedException();
 }