Exemple #1
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hash = 17;

                hash = hash * 31 + NeuronIndex.GetHashCode();
                hash = hash * 31 + RegionIndex.GetHashCode();
                hash = hash * 31 + Type.GetHashCode();

                return(hash);
            }
        }
        /// <summary>
        /// Displays a page showing all the information about one region.
        /// </summary>
        /// <param name="id">The id of the region whose information to show</param>
        /// <returns>Regions details view</returns>
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TempData["RegionID"] = id;
            RegionIndex viewModel = new RegionIndex();
            //take details of Region
            Region region = await db.Regions.FindAsync(id);

            if (region == null)
            {
                return(HttpNotFound());
            }
            viewModel.region = region;

            var teritory = from t in db.Territories
                           where (t.RegionID == id)
                           select new { t.TerritoryID, t.TerritoryDescription };

            List <RegionDetails> list = new List <RegionDetails>();

            //lopp in all territories
            foreach (var item in teritory)
            {
                RegionDetails regionDetail = new RegionDetails();

                regionDetail.TerritoryID          = item.TerritoryID;
                regionDetail.TerritoryDescription = item.TerritoryDescription;

                list.Add(regionDetail);
            }
            viewModel.details = list;
            ViewBag.regionid  = id;
            return(View(viewModel));
        }