Exemplo n.º 1
0
        public JsonResult SaveResource(Resource resource)
        {
            string   errorMessage;
            Resource newResource;

            if (resource.Id == 0)
            {
                newResource = ResourceUtility.AddResource(resource, out errorMessage);
            }
            else
            {
                newResource = ResourceUtility.EditResource(resource, out errorMessage);
            }

            if (errorMessage == null)
            {
                return(Json(newResource, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(errorMessage, JsonRequestBehavior.AllowGet));
            }
        }