Пример #1
0
 private void CopyWriteableValues(PhotoData newValues, Photo existingValues)
 {
     existingValues.Card = newValues.Card;
     var photographer = _db.Photographers.Find(ph => ph.Initials == newValues.PhotographerInitials).FirstOrDefault();
     if (photographer != null)
         existingValues.Photographer = photographer;
     existingValues.Event = _db.Events.Find(e => e.EventName == newValues.Event).SingleOrDefault();
     existingValues.Sequence = newValues.Sequence;
     existingValues.Station = newValues.Station;
 }
Пример #2
0
 // PUT api/photos/5
 public void Put(Guid id, PhotoData newValues)
 {
     var existingValues = _db.Photos.FindById(id);
     if (existingValues == null)
         throw new HttpResponseException(HttpStatusCode.NotFound);
     CopyWriteableValues(newValues, existingValues);
     _db.SaveChanges();
 }