Пример #1
0
        public ActionResult Edit(VoucherEditModel _VoucherEditModel)
        {
            if (ModelState.IsValid)
            {
                Voucher _VoucherToEdit = _voucherRepo.GetVoucher(_VoucherEditModel.ID);

                AutoMapper.Mapper.CreateMap<VoucherEditModel,Voucher>();
                AutoMapper.Mapper.Map(_VoucherEditModel, _VoucherToEdit);

                db.Entry(_VoucherToEdit).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(_VoucherEditModel);
        }
Пример #2
0
        //
        // GET: /Voucher/Edit/5
        public ActionResult Edit(int id)
        {
            Voucher _voucher = _voucherRepo.GetVoucher(id);
            VoucherEditModel _VoucherEditModel = new VoucherEditModel();

            AutoMapper.Mapper.CreateMap<Voucher, VoucherEditModel>();
            AutoMapper.Mapper.Map(_voucher, _VoucherEditModel);

            return View(_VoucherEditModel);
        }