// GET: CountryPublisheds/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            CountryViewModel model;

            try
            {
                if (id == null)
                {
                    //return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                    return(PartialView("PartialNotFound", id.ToString()));
                }
                CountryPublished countryPublished = await db.CountryPublisheds.FindAsync(id);

                if (countryPublished == null)
                {
                    //return HttpNotFound();
                    return(PartialView("PartialNotFound", id.ToString()));
                }
                model = CauntryRelase.DetailsCountry(countryPublished);

                return(View(model));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
Esempio n. 2
0
        public static CountryViewModel EditCountry(CountryPublished country)
        {
            var model = new CountryViewModel
            {
                Id          = country.Id,
                CountryName = country.CountryName,
                PhoneCode   = country.PhoneCode,
                IsoCode     = country.IsoCode,
            };

            return(model);
        }
Esempio n. 3
0
        public static CountryPublished EditCountry(CountryViewModel model)
        {
            CountryPublished country = new CountryPublished
            {
                Id          = model.Id,
                CountryName = model.CountryName,
                PhoneCode   = model.PhoneCode,
                IsoCode     = model.IsoCode,
            };

            return(country);
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            try
            {
                CountryPublished countryPublished = await db.CountryPublisheds.FindAsync(id);

                db.CountryPublisheds.Remove(countryPublished);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
        public async Task <ActionResult> Delete(int?id)
        {
            try
            {
                if (id == null)
                {
                    //return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                    return(PartialView("PartialNotFound", id.ToString()));
                }
                CountryPublished countryPublished = await db.CountryPublisheds.FindAsync(id);

                if (countryPublished == null)
                {
                    //return HttpNotFound();
                    return(PartialView("PartialNotFound", id.ToString()));
                }
                return(View(countryPublished));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }