Ejemplo n.º 1
0
        public ActionResult DeleteClient(string urlEncodedJsonclient)
        {
            if (Session["userToken"] == null)
            {
                return(RedirectToAction("Login"));
            }

            var jsonClient = HttpUtility.UrlDecode(urlEncodedJsonclient);

            ServiceReference1.Client client = new JavaScriptSerializer().Deserialize <ServiceReference1.Client>(jsonClient);

            try
            {
                bool clientIsDeleted = serviceRef.DeleteClient(Session["userToken"].ToString(), client);
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = ex.Message;
            }

            return(RedirectToAction("Index"));
        }