public async Task <IActionResult> CreateReportSearchCriteria(InvoiceConstructorSearchViewModel model) { if (ModelState.IsValid) { var item = await _businessManager.CreateInvoiceConstructorSearchCriterias(_mapper.Map <InvoiceConstructorSearchDto>(model)); if (item == null) { return(NotFound()); } return(Ok(_mapper.Map <InvoiceConstructorSearchViewModel>(item))); } return(BadRequest(model)); }
public async Task <IActionResult> Create(InvoiceConstructorSearchViewModel model) { try { if (ModelState.IsValid) { var item = await _businessManager.CreateInvoiceConstructorSearchCriterias(_mapper.Map <InvoiceConstructorSearchDto>(model)); if (item == null) { return(NotFound()); } //model = _mapper.Map<CustomerViewModel>(item); return(RedirectToAction(nameof(Edit), new { id = item.Id })); } } catch (Exception er) { _logger.LogError(er, er.Message); } // ReportSearchCriteriaViewModel model = new ReportSearchCriteriaViewModel(); var customerTags = await _businessManager.GetCustomerTags(); ViewBag.CustomerTags = customerTags.Select(x => new SelectListItem() { Text = x.Name, Value = x.Id.ToString() }).ToList(); var customerTypes = await _customerBusinessManager.GetCustomerTypes(); ViewBag.CustomerTypes = customerTypes.Select(x => new SelectListItem() { Text = x.Name, Value = x.Id.ToString() }).ToList(); var rechecks = model.Recheck; if (rechecks == null || rechecks.Count() == 0) { rechecks.Add(0); } ViewBag.CustomerRechecks = rechecks.Select(x => new SelectListItem() { Text = x.ToString(), Value = x.ToString() }).ToList(); return(View("Create", model)); }