private ActionResult Update(RejectParser model, RejectParser target)
        {
            model.Name = target.Name;
            model.Lines.RemoveEach(model.Lines.Where(x => !target.Lines.Any(y => y.Id == x.Id)));
            model.Lines.Each(x => {
                var src = target.Lines.First(y => y.Id == x.Id);
                x.Dst   = src.Dst;
                x.Src   = src.Src;
            });
            model.Lines.AddEach(target.Lines.Where(x => x.Id == 0));
            DbSession.Save(model);

            Notify("Сохранено");
            return(RedirectToAction("Edit", new { parserId = model.Id }));
        }
        public ActionResult Edit(uint parserId)
        {
            var model = DbSession.Load <RejectParser>(parserId);

            ViewBag.Supplier = model.Supplier;
            if (Request.HttpMethod == "POST")
            {
                var target = new RejectParser();
                if (!TryUpdateModel(target))
                {
                    return(View(target));
                }

                return(Update(model, target));
            }
            return(View(model));
        }
        public ActionResult Add(uint supplierId)
        {
            var model = new RejectParser(DbSession.Load <Supplier>(supplierId));

            ViewBag.Supplier = model.Supplier;

            if (Request.HttpMethod == "POST")
            {
                var target = new RejectParser(model.Supplier);
                if (!TryUpdateModel(target))
                {
                    return(View("Edit", target));
                }

                return(Update(model, target));
            }

            return(View("Edit", model));
        }