Example #1
0
 public HttpResponseMessage Put([FromBody] Profile profile)
 {
     try
     {
         var dbProfile = _db.Profiles.ToList().Find(p => p.Id == profile.Id);
         dbProfile.FirstName    = profile.FirstName;
         dbProfile.LastName     = profile.LastName;
         dbProfile.EmailAddress = profile.EmailAddress;
         dbProfile.PhoneNumber  = profile.PhoneNumber;
         dbProfile.DeActivate   = profile.DeActivate;
         _db.Save();
         return(Request.CreateResponse(HttpStatusCode.Created, profile));
     }
     catch (Exception)
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest));
     }
 }
 public HttpResponseMessage Put([FromBody] ReminderModel reminder)
 {
     try
     {
         var dbReminder = _db.Reminders.ToList().Find(r => r.Id == reminder.Id);
         dbReminder.ContactId        = reminder.ContactId;
         dbReminder.Message          = reminder.Message;
         dbReminder.ProfileId        = reminder.ProfileId;
         dbReminder.ReminderDateTime = reminder.ReminderDateTime;
         dbReminder.Sent             = reminder.Sent;
         dbReminder.Recurrence       = reminder.Recurrence;
         dbReminder.WeekDay          = reminder.WeekDay;
         _db.Save();
         return(Request.CreateResponse(HttpStatusCode.Created, reminder));
     }
     catch (Exception)
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest));
     }
 }
Example #3
0
 public HttpResponseMessage Put([FromBody] Contact contact)
 {
     try
     {
         var dbContact = _db.Contacts.ToList().Find(c => c.Id == contact.Id);
         dbContact.FirstName    = contact.FirstName;
         dbContact.LastName     = contact.LastName;
         dbContact.EmailAddress = contact.EmailAddress;
         dbContact.PhoneNumber  = contact.PhoneNumber;
         dbContact.Active       = contact.Active;
         dbContact.SendEmail    = contact.SendEmail;
         dbContact.SendSMS      = contact.SendSMS;
         dbContact.TimeZone     = contact.TimeZone;
         _db.Save();
         return(Request.CreateResponse(HttpStatusCode.Created, contact));
     }
     catch (Exception)
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest));
     }
 }
Example #4
0
 private void RecordReminderSent(Reminder reminder)
 {
     _db.Reminders.ToList().Find(r => r.Id == reminder.Id).Sent = true;
     _db.Save();
 }