Ejemplo n.º 1
0
        public IHttpActionResult PostElement(Element element)
        {
            if (element == null)
            {
                return(BadRequest("element cannot be found in the request body request"));
            }
            try
            {
                element.CreatedDate = DateTime.Now;
                elementsService.CreateElement(element);

                var elements    = elementsService.GetElements();
                var partialView = Helpers.RenderPartial("~/Views/Shared/Partial/Elements/ElementsList.cshtml", elements);
                return(Ok(partialView));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }