BExIS.Web.Shell.Areas.RPM.Controllers.DataStructureEditController._getDataTypes C# (CSharp) Method

_getDataTypes() public method

public _getDataTypes ( long unitId ) : System.Web.Mvc.ActionResult
unitId long
return System.Web.Mvc.ActionResult
        public ActionResult _getDataTypes(long unitId)
        {
            List<ItemStruct> DataTypes = new List<ItemStruct>();
            Unit unit = new UnitManager().Repo.Get(unitId);
            if (unit.Name.ToLower() != "none")
            {
                foreach (DataType dt in unit.AssociatedDataTypes)
                {
                    DataTypes.Add(new ItemStruct()
                    {
                        Name = dt.Name,
                        Id = dt.Id
                    });
                }
                return PartialView("_dataTypeDropdown", DataTypes.OrderBy(dt => dt.Name).ToList());
            }
            else
            {
                foreach (DataType dt in new DataTypeManager().Repo.Get())
                {
                    DataTypes.Add(new ItemStruct()
                    {
                        Name = dt.Name,
                        Id = dt.Id
                    });
                }
                return PartialView("_dataTypeDropdown", DataTypes.OrderBy(dt => dt.Name).ToList());
            }
        }