Example #1
0
        public async Task <IActionResult> Index([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;
                }
            }
            VehicleType vehicleType = new VehicleType
            {
                Id = (int)model.vehicleTypeId,
                vehicleTypeName   = model.vehicleTypeName,
                vehicleTypeNameBn = model.vehicleTypeNameBn,
                imagePath         = attachPath
            };
            await lostAndFoundType.SaveVehicleType(vehicleType);

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