Example #1
0
        public PaymentMethod MapPaymentMethodDTO(PaymentMethodDTO input)
        {
            PaymentMethod output = new PaymentMethod();

            output.Description = input.Description;
            output.PaymentMethodId = input.PaymentMethodId;

            return output;
        }
Example #2
0
        public ActionResult PaymentMethodPost(PaymentMethodDTO paymentMethodDTO)
        {
            if (!ModelState.IsValid)
                throw new HttpException(400, "Invalid data.");

            PaymentMethod paymentMethod = _mapper.MapPaymentMethodDTO(paymentMethodDTO);

            if (_paymentMethodService.Exists(paymentMethodDTO.PaymentMethodId))
                _paymentMethodService.Update(paymentMethod);
            else
                _paymentMethodService.Insert(paymentMethod);

            return RedirectToAction("PaymentMethods");
        }