Exemple #1
0
        public async Task <IActionResult> Index([FromForm] DocumentTypeViewModel model)
        {
            string attachPath = string.Empty;

            if (model.formFile != null)
            {
                string fileName;
                string message = FileSave.SaveImage(out fileName, "Upload/Attachment/DocumentType", model.formFile);

                if (message == "success")
                {
                    attachPath = fileName;
                }
            }
            DocumentType documentType = new DocumentType
            {
                Id = (int)model.documentTypeId,
                documentTypeName   = model.documentTypeName,
                documentTypeNameBn = model.documentTypeNameBn,
                shortOrder         = model.shortOrder,
                imagePath          = attachPath
            };
            await lostAndFoundType.SaveDocumentType(documentType);

            return(RedirectToAction(nameof(Index)));
        }