示例#1
0
        public async Task <IActionResult> CreateAsync(CreateODServiceRequestViewModel model)
        {
            if (ModelState.IsValid)
            {
                string ImageUrl = ProcessUploadedImage(model.Image);

                ServiceType serviceType = await _serviceTypeRepository.GetServiceTypeByIdAsync(model.ServiceTypeId);

                ServiceRequest newODServiceRequest = new ServiceRequest
                {
                    ApplicantName   = model.FullName,
                    ServiceTypeId   = model.ServiceTypeId,
                    Location        = model.Location,
                    ImageUrl        = ImageUrl,
                    ApplicantId     = model.ApplicantId,
                    ApplicationDate = DateTime.Now,
                    Status          = "Pending"
                };
                await _oDServiceRequestRepository.AddAsync(newODServiceRequest);

                return(RedirectToAction("RequestComplete"));
            }
            return(View());
        }