Example #1
0
        public ActionResult Delete(int id)
        {
            Location location = _locationmanager.Find(x => x.Id == id).FirstOrDefault();

            _locationmanager.Remove(location);
            _locationmanager.SaveChanges();
            TempData["Success"] = "Deleted Successfully!";

            return(RedirectToAction("Index"));
        }
Example #2
0
        public ActionResult Delete(int id)
        {
            var location = _locationManager.GetById(id);

            try
            {
                if (_locationManager.Remove(location))
                {
                    ViewBag.Msg = "Location deleted Successfully";
                }
            }
            catch (Exception exception)
            {
                ViewBag.Msg = exception.GetType().ToString();
            }

            return(View("Search"));
        }