Ejemplo n.º 1
0
        public IActionResult TemplateBox(int docId, [FromQuery] int pageIndex, [FromQuery] string boxKey)
        {
            var project = _fileDatabase.GetDocumentById(docId);

            var model = TemplateBoxModalViewModel.From(project, docId, pageIndex, boxKey);

            return(PartialView("EditTemplateBox", model) !);
        }
Ejemplo n.º 2
0
        public IActionResult TemplateBox([FromForm] TemplateBoxModalViewModel model)
        {
            // Check against existing version
            var existing = _fileDatabase.GetDocumentById(model.DocumentId);

            if (existing.Version is not null && model.Version < existing.Version)
            {
                return(Content("OLD") !);
            }

            // Copy new values across
            model.CopyTo(existing);

            // Write back to store
            _fileDatabase.SaveDocumentTemplate(existing, model.DocumentId);
            return(Content("OK") !);
        }