public HttpResponseMessage UpdateEventPreference(EventPreference updateRecord)
        {
            try
            {
                if (updateRecord == null)
                {
                    return(new HttpResponseMessage(HttpStatusCode.BadRequest));
                }

                // Update the Event Preference record in the Azure SQL DB:
                int eventPreferenceResult = _eventPreferenceWorker.UpdateCreate(updateRecord);
                if (eventPreferenceResult > 0)
                {
                    return(new HttpResponseMessage(HttpStatusCode.OK));
                }
                // Existed already:
                else if (eventPreferenceResult == 0)
                {
                    return(new HttpResponseMessage(HttpStatusCode.OK));
                }

                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            catch (Exception e)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }
        }
예제 #2
0
파일: Event.cs 프로젝트: subratb/GEDKeeper
 public Event(GDMDateValue date, string evType, string description, string overview, string note,
              bool important, bool capitalise)
 {
     fPreference = EventPreference.Unknown;
     fDate       = date;
     if (capitalise)
     {
         GMHelper.Capitalise(ref description);
     }
     if (description.Length > 0)
     {
         if (description[description.Length - 1] == '.')
         {
             fDescription = description.Substring(0, description.Length - 1);
         }
         else
         {
             fDescription = description;
         }
     }
     fOverview  = overview;
     fImportant = important;
     fNote      = note;
     if (note == "")
     {
         fNote = null;
     }
     fType = evType;
 }