예제 #1
0
        public IActionResult AddAttachment(AddAttachmentViewModel model)
        {
            if (ModelState.IsValid)
            {
                string             uniqueFileName = ProcessUploadedAttachment(model);
                EmployeeAttachment newAttachment  = new EmployeeAttachment
                {
                    FileName   = model.FileName,
                    EmployeeId = model.EmployeeId,
                    FileId     = model.FileId,

                    Notes    = model.Notes,
                    Type     = model.Type,
                    FileSize = model.FileSize,
                    URLOnly  = uniqueFileName
                };
                _employeeRepository.AddEmpAttachment(newAttachment);

                var successMessage = "Attachment Info Created Successfully. Name: " + newAttachment.EmployeeId;
                TempData["successAlert"] = successMessage;
                return(View(successMessage, ""));
            }
            return(View());
        }