public static void InsertGuestbook(Guestbook guestbookEntity) { try { using (var db = new MariaMatteoWedDBEntities()) { db.Guestbook.Add(guestbookEntity); db.SaveChanges(); } }catch (Exception exc) { exc.WriteToLog(); throw exc; } }
public static void InsertRSVP(RSVP rsvpEntity) { try { using (var db = new MariaMatteoWedDBEntities()) { db.RSVP.Add(rsvpEntity); db.SaveChanges(); } } catch (Exception exc) { exc.WriteToLog(); throw exc; } }
public static void UpdateRSVP(RSVP rsvpEntity, int lastId, string lastGUID) { try { using (var db = new MariaMatteoWedDBEntities()) { DateTime maxDateTime = DateTimeUtilities.MaxDateTime(); var current = db.RSVP.Where(x => x.IdRsvp == lastId && x.Guid == lastGUID && x.DataFine == maxDateTime).FirstOrDefault(); if (current != null) { current.DataFine = rsvpEntity.DataInizio; } db.RSVP.Add(rsvpEntity); db.SaveChanges(); } } catch (Exception exc) { exc.WriteToLog(); throw exc; } }