예제 #1
0
        public async Task <IActionResult> VehicleModel([FromForm] VehicleInformationViewModel model)
        {
            string attachPath = string.Empty;

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

                if (message == "success")
                {
                    attachPath = fileName;
                }
            }
            VehicleModel vehicleModel = new VehicleModel
            {
                Id            = (int)model.modelId,
                vehicleTypeId = model.vehicleTypeId,
                modelName     = model.modelName,
                imagePath     = attachPath
            };
            await lostAndFoundType.SaveVehicleModel(vehicleModel);

            return(RedirectToAction(nameof(VehicleModel)));
        }