예제 #1
0
        public ActionResult ListPropertyType(string startfrom, string startfromproperty, string listtype, bool exact = false, int max = 0)
        {
            PageTitle = "List Property Type";

            var model = new ListPropertyTypeViewModel();

            model.Overview = new Infrastructure.ViewModels.ContentViewModel().AddTitle("List Property Type").AddParagraph("List all property types. If an optional start from type is entered, the list will start with this type. If a table type is entered, a starting property type can be entered.");

            if (!string.IsNullOrEmpty(startfrom) || !string.IsNullOrEmpty(startfromproperty) || !string.IsNullOrEmpty(listtype))
            {
                model.StartFromTableType = startfrom;
                model.StartFromProperty  = startfromproperty;
                model.ExactLookup        = exact;
                model.MaxRows            = max;
                model.ListType           = listtype;
                var listTypeChar = '\0';
                char.TryParse(listtype, out listTypeChar);
                var results = AdwAdminService.GetPropertyTypeList(model.StartFromTableType, model.StartFromProperty, listTypeChar, model.ExactLookup, model.MaxRows);

                model.Results = results.ToPageablePropertyViewModel();

                if (model.Results == null || (model.Results != null && !model.Results.Any()))
                {
                    AddInformationMessage("No results returned.");
                }
            }

            return(View(model));
        }
예제 #2
0
        public ActionResult ListPropertyType(ListPropertyTypeViewModel model)
        {
            if (ModelState.IsValid)
            {
                var routeValueDictionary = new RouteValueDictionary();
                routeValueDictionary.Add("startfrom", model.StartFromTableType);
                routeValueDictionary.Add("startfromproperty", model.StartFromProperty);
                routeValueDictionary.Add("listtype", model.ListType);
                routeValueDictionary.Add("exact", model.ExactLookup);
                routeValueDictionary.Add("max", model.MaxRows);

                return(RedirectToAction("ListPropertyType", routeValueDictionary));
            }

            return(View(model));
        }