/// <summary> /// [트리만들기 이벤트] 개인정보 저장 /// </summary> /// <param name="entry"></param> /// <returns></returns> public Christmas2015MakeTree CreateChristmas2015MakeTree(Christmas2015MakeTree entry) { var result = context.Christmas2015MakeTrees.Add(entry); context.SaveChanges(); return(result); }
/// <summary> /// [트리만들기 이벤트] 장난감 정보,합성이미지 Update /// </summary> /// <param name="entry"></param> /// <returns></returns> public Christmas2015MakeTree UpdateChristmas2015MakeTreeById(Christmas2015MakeTree entry) { var updateModel = context.Christmas2015MakeTrees.Where(e => e.Id.Equals(entry.Id)).SingleOrDefault(); if (updateModel != null) { updateModel.SynthesisImage = entry.SynthesisImage; updateModel.Content = entry.Content; updateModel.Toy1 = entry.Toy1; updateModel.Toy2 = entry.Toy2; updateModel.Toy3 = entry.Toy3; updateModel.Toy4 = entry.Toy4; updateModel.Toy5 = entry.Toy5; updateModel.Toy6 = entry.Toy6; updateModel.Toy7 = entry.Toy7; var updateEntry = context.Entry(updateModel); updateEntry.Property(e => e.SynthesisImage).IsModified = true; updateEntry.Property(e => e.Content).IsModified = true; updateEntry.Property(e => e.Toy1).IsModified = true; updateEntry.Property(e => e.Toy2).IsModified = true; updateEntry.Property(e => e.Toy3).IsModified = true; updateEntry.Property(e => e.Toy4).IsModified = true; updateEntry.Property(e => e.Toy5).IsModified = true; updateEntry.Property(e => e.Toy6).IsModified = true; updateEntry.Property(e => e.Toy7).IsModified = true; context.SaveChanges(); } return(updateModel); }