public async Task <IActionResult> Details(int id) { var part = await _partsService.GetPartOrDefaultById(id, false); if (part == null) { return(new BadRequestResult()); } var viewmodel = _mapper.Map <PartsDetailsViewModel>(part); return(View(viewmodel)); }
public async Task <IActionResult> OnAddToReceivingListPost(InventoryReceiveViewModel vm) { if (!String.IsNullOrWhiteSpace(vm.InputPartNumber) && vm.InputQuantity > 0) { var part = await _partsService.GetPartOrDefaultById(vm.PartId, false); if (part != null) { var mappedVm = _mapper.Map <InventoryReceiveItemViewModel>(part); mappedVm.Qty = vm.InputQuantity; return(PartialView("_ReceiveListPartial", mappedVm)); } } return(NotFound()); }