public ActionResult LogOff()
 {
     AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
     //Clear cache when logging out
     MessageWebService.ClearCache();
     return(RedirectToAction("Index", "App"));
 }
示例#2
0
        public IHttpActionResult GetRoadConditions()
        {
            var webClient = new MessageWebService();
            var result    = webClient.GetRoadConditions();

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

            return(Ok(result));
        }
        public ActionResult RoadConditions()
        {
            var webClient = new MessageWebService();
            var result    = webClient.GetRoadConditions();

            if (result == null)
            {
                return(HttpNotFound());
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public ActionResult RoadConditions()
        {
            var user = UserManager.FindById(User.Identity.GetUserId());

            if (user != null)
            {
                StartLocation = user.StartLocation;
            }

            var webClient = new MessageWebService(StartLocation);
            var result    = webClient.GetRoadConditions();

            if (result == null)
            {
                return(HttpNotFound());
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Save(FormCollection collection)
        {
            if (TryUpdateModel(_model, new[] { "StartLocation" }, collection))
            {
                var user = UserManager.FindById(User.Identity.GetUserId());
                user.StartLocation = Convert.ToInt32(collection["countyDropDownList"]);
                var result = UserManager.Update(user);
                TempData["savedToXml"] = "Inställningen sparades";

                //Remove items from cache when a new default location is choosen
                MessageWebService.ClearCache();
            }
            else
            {
                TempData["savedToXml"] = "Fel!Försök igen.";
            }

            ////Saves new county to xml-file and saves a confirmaton message
            //_model.SelectedCounty = Convert.ToInt32(collection["countyDropDownList"]);
            //TempData["savedToXml"] = "Inställningen sparades";

            return(RedirectToAction("Index"));
        }