Esempio n. 1
0
        public HttpResponseMessage Delete([FromBody] CalendarItemModel model)
        {
            try
            {
                var exist         = TheCalendarSupport.GetCalendarItemById(model.SiteUrl, model.ListName, model.ID);
                var deleteRequest = false;
                if (exist == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }
                deleteRequest = TheCalendarSupport.DeleteCalendarItemById(model.SiteUrl, model.ListName, model.ID);

                if (deleteRequest)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Esempio n. 2
0
 public HttpResponseMessage Get(string siteUrl, string listName, int id, string localTimeZone)
 {
     var results = TheModelFactory.Create(TheCalendarSupport.GetCalendarItemById(siteUrl, listName, id, localTimeZone));
     if (results != null)
     {
         return Request.CreateResponse(HttpStatusCode.OK, results);
     }
     else
     {
         return Request.CreateErrorResponse(HttpStatusCode.NotFound, "Can't find calendar list");
     }
 }
        public HttpResponseMessage Get(int id, string listName, string siteUrl)
        {
            CalendarItem result = new CalendarItem();

            result = TheCalendarSupport.GetCalendarItemById(siteUrl, listName, id);
            if (result != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Can't find calendar list"));
            }
        }
Esempio n. 4
0
        public HttpResponseMessage Get(string siteUrl, string listName, int id)
        {
            var results = TheModelFactory.Create(TheCalendarSupport.GetCalendarItemById(siteUrl, listName, id));

            return(Request.CreateResponse(HttpStatusCode.OK, results));
        }