public ActionResult Create(Domain.Environment.DTOs.External.Environment Environment) { if (this.ControllerContext.HttpContext.Request.Cookies.AllKeys.Contains("UserCookie")) { HttpCookie cookie = this.ControllerContext.HttpContext.Request.Cookies["UserCookie"]; int UserId = Convert.ToInt32(cookie.Values["Id"]); Environment.UserId = UserId; Domain.Environment.EnvironmentDomain ed = new Domain.Environment.EnvironmentDomain(); ed.SaveEnvironment(Environment); return(RedirectToAction("Index")); } return(RedirectToAction("Create")); }