private bool EditCarrier(CarrierModel carrier)
        {
            var editWindow  = new EditCarrierWindow();
            var ctx         = (EditCarrierViewModel)editWindow.DataContext;
            var carrierCopy = new CarrierModel();

            CopyFields(carrier, carrierCopy);
            ctx.Carrier = carrierCopy;
            if (editWindow.ShowDialog() != true)
            {
                return(false);
            }
            var errs = GetModelErrors(carrierCopy);

            if (errs != string.Empty)
            {
                ShowError(errs, "Error! Saving cancelled. ");
                return(false);
            }

            CopyFields(carrierCopy, carrier);
            _carrierService.EditCarrier(carrier);
            return(true);
        }
Ejemplo n.º 2
0
        public ActionResult Edit(CarrierViewModel carrier)
        {
            _carrierService.EditCarrier(Mapper.Map <CarrierDTO>(carrier));

            return(RedirectToAction("Index"));
        }