Example #1
0
        public ActionResult Create(AddressVM address)
        {
            Address a = new Address();
            if (ModelState.IsValid)
            {
                a = MapModel(address);
                _addressservice.AddRecord(a);
                return RedirectToAction(Constant.Controller.Index);
            }

            return View(a);
        }
Example #2
0
 //Mapping Model to ModelViewModel without the use of AutoMapper
 private AddressVM MapModelVM(Address address)
 {
     AddressVM addressVM = new AddressVM
     {
         ID = address.ID,
         Name = address.Name,
         Line1 = address.Line1,
         Line2 = address.Line2,
         City = address.City,
         State = address.State,
         Zip = address.Zip
     };
     return addressVM;
 }