public async Task <IActionResult> SaveVehicleWithImage(GDViewModel model) { try { var user = await _userManager.FindByNameAsync(model.userName); string gdNumber = RandomString(6); GDInformation gDInformation = new GDInformation { ApplicationUserId = user.Id, gdFor = "Own", gdDate = DateTime.Now, gdNumber = gdNumber, gDTypeId = model.gdTypeId, productTypeId = 1, //documentTypeId = model.documentTypeId == 0 ? null : model.documentTypeId, //documentDescription = model.documentDescription, statusId = 1 }; int gdId = await lostAndFoundService.SaveGDInformation(gDInformation); VehicleInformation vehicleInformation = new VehicleInformation { gDInformationId = gdId, vehicleTypeId = model.vehicleTypeId, vehicleBrandId = model.vehicleBrandId, vehicleRegNo = model.regNoFirstPart + " " + model.regNoSecondPart + " " + model.regNoThiredPart, regNoFirstPart = model.regNoFirstPart, regNoSecondPart = model.regNoSecondPart, regNoThiredPart = model.regNoThiredPart, //madeBy = model.madeBy, //madeIn = model.madeIn, //modelNo = model.modelNo, //mfcDate = model.mfcDate, engineNo = model.engineNo, //chasisNo = model.chasisNo, //ccNo = model.ccNo, vehicleModelNo = model.modelNo }; int vchid = await lostAndFoundService.SaveVehicleInformation(vehicleInformation); AttachmentInformation attachment = new AttachmentInformation { gDInformationId = gdId, encodedImage = model.encodedImage, fileSubject = model.vehicleDescription }; int imageId = await lostAndFoundService.SaveAttachmentInformation(attachment); return(Ok(gdId)); } catch (Exception ex) { throw ex; } }