Example #1
0
        /// <summary>
        /// См. <see cref="UrlHelper.Action(string, string, object)"/>. Генерирует адрес для зоны "пользовательская".
        /// </summary>
        public static string ActionUser(this UrlHelper url, string action, string controllerName, object routeValues)
        {
            var values = TypeHelper.ObjectToDictionary(routeValues);

            TypeHelper.AddAnonymousObjectToDictionary(values, new { area = AreaConstants.User });

            return(url.Action(action, controllerName, values));
        }
        public void AddAnonymousTypeObjectToDictionaryTest()
        {
            IDictionary <string, object> d = new Dictionary <string, object>();

            d.Add("X", "Xvalue");
            TypeHelper.AddAnonymousObjectToDictionary(d, new { A = "a", B = "b" });
            Assert.Equal("Xvalue", d["X"]);
            Assert.Equal("a", d["A"]);
            Assert.Equal("b", d["B"]);
        }