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));
            }
        }
Exemplo n.º 2
0
 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;
 }