public async Task <IActionResult> Create(ReceivingViewModel receiving)
        {
            if (ModelState.IsValid)
            {
                var receivingModel = _mapper.Map <ReceivingViewModel, Receiving>(receiving);
                await _orderRepository.AddReceiving(receivingModel);

                return(RedirectToAction("Index", "Receivings"));
            }
            await GenerateDropdowns();

            return(View(receiving));
        }
        public async Task <IActionResult> Edit(ReceivingViewModel receiving)
        {
            if (ModelState.IsValid)
            {
                var receivingModel = _mapper.Map <ReceivingViewModel, Receiving>(receiving);
                await _orderRepository.UpdateReceiving(receivingModel);

                return(RedirectToAction("Details", "Receivings", new { orderId = receiving.Id }));
            }
            await GenerateDropdowns();

            return(View(receiving));
        }
Exemplo n.º 3
0
        public ActionResult AgentDoctorReceivePackage(string barcode)
        {
            var model = new ReceivingViewModel();

            try
            {
                MedicationPackageBLL.ReceivePackage(barcode);
                model.Result = new Notification {
                    Level = NotificationLevel.Info, Message = "Receive package succeeded"
                };
            }
            catch (ENETCareException ex)
            {
                model.Result = new Notification {
                    Level = NotificationLevel.Error, Message = ex.Message
                };
            }
            ModelState.Clear();
            return(View(model));
        }