Example #1
0
        public async Task <IActionResult> OccupationInfo([FromForm] OccupationViewModel model)
        {
            string attachPath = string.Empty;

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

                if (message == "success")
                {
                    attachPath = fileName;
                }
            }
            Occupation occupation = new Occupation
            {
                Id        = (int)model.occupationId,
                name      = model.name,
                nameBn    = model.nameBn,
                imagePath = attachPath
            };
            await lostAndFoundType.SaveOccupation(occupation);

            return(RedirectToAction(nameof(OccupationInfo)));
        }