Ejemplo n.º 1
0
        public bool UpdateTemplate(CMSTemplateUpdateRequest template)
        {
            bool id = false;

            DataProvider.ExecuteNonQuery(GetConnection, "dbo.CMSTemplates_Update"
               , inputParamMapper: delegate (SqlParameterCollection paramCollection)
               {
                   paramCollection.AddWithValue("@Name", template.Name);
                   paramCollection.AddWithValue("@Path", template.Path);
                   paramCollection.AddWithValue("@Id", template.Id);

               }, returnParameters: delegate (SqlParameterCollection param)
               {
                   id = true;
               });
            return id;
        }
        public HttpResponseMessage UpdateTemplate(CMSTemplateUpdateRequest model)
        {
            // if the Model does not pass validation, there will be an Error response returned with errors
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            string userId = _userService.GetCurrentUserId();
            ItemResponse<bool> response = new ItemResponse<bool>();
            //pass in userId to page method

            response.Item = _cmsService.UpdateTemplate(model);

            return Request.CreateResponse(response);
        }