Example #1
0
        //
        // GET: /Country/Edit/5
        public ActionResult Edit(int id)
        {
            Country country = _Country.GetById(id);

            if (country == null)
            {
                return(HttpNotFound());
            }
            return(View(country));
        }
        //GET
        public ActionResult Edit(int id)
        {
            var dbItem = _countryManager.GetById(id);

            if (dbItem == null)
            {
                throw new NullReferenceException();
            }
            return(View(_countryFieldCopier.CopyFields(dbItem, new CountryViewModel())));
        }
        public IActionResult Update(int?id)
        {
            if (HttpContext.Session.GetString("AdminId") != null)
            {
                if (id == null)
                {
                    return(NotFound());
                }

                Country aCountryDetails = _iCountryManager.GetById(id);

                if (aCountryDetails == null)
                {
                    return(NotFound());
                }

                return(View(aCountryDetails));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }