Example #1
0
        public Models.Event Add(Models.Event model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ModelState));
                }

                EventServices service = new EventServices();
                return(service.CreateNewEvent(model));
            }
            catch (HttpResponseException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                //this catch is for unexpected error
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex));
            }
        }