Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ShaftId,Ylower,Yupper,North,Xlower,Xupper,East,Subplot")] ShaftLocation shaftLocation)
        {
            if (id != shaftLocation.ShaftId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    shaftLocation.Lookup = $"{shaftLocation.Xlower}/{shaftLocation.Xupper} {shaftLocation.North} {shaftLocation.Ylower}/{shaftLocation.Yupper} {shaftLocation.East} {shaftLocation.Subplot}";
                    _context.Update(shaftLocation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShaftLocationExists(shaftLocation.ShaftId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.NorthSouth = new SelectList(CardinalDirections.NorthSouth(), shaftLocation.North);
            ViewBag.EastWest   = new SelectList(CardinalDirections.EastWest(), shaftLocation.East);
            ViewBag.Subplots   = new SelectList(CardinalDirections.SubPlots(), shaftLocation.Subplot);
            return(View(shaftLocation));
        }
Ejemplo n.º 2
0
 public IActionResult Create()
 {
     //ViewData["TombId"] = new SelectList(_context.TombLocations, "TombLocationId", "LookupValue", mummy.TombId);
     ViewBag.NorthSouth = new SelectList(CardinalDirections.NorthSouth());
     ViewBag.EastWest   = new SelectList(CardinalDirections.EastWest());
     ViewBag.Subplots   = new SelectList(CardinalDirections.SubPlots());
     return(View());
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("ShaftId,Ylower,Yupper,North,Xlower,Xupper,East,Subplot")] ShaftLocation shaftLocation)
        {
            if (ModelState.IsValid)
            {
                shaftLocation.Lookup = $"{shaftLocation.Xlower}/{shaftLocation.Xupper} {shaftLocation.North} {shaftLocation.Ylower}/{shaftLocation.Yupper} {shaftLocation.East} {shaftLocation.Subplot}";
                _context.Add(shaftLocation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.NorthSouth = new SelectList(CardinalDirections.NorthSouth(), shaftLocation.North);
            ViewBag.EastWest   = new SelectList(CardinalDirections.EastWest(), shaftLocation.East);
            ViewBag.Subplots   = new SelectList(CardinalDirections.SubPlots(), shaftLocation.Subplot);
            return(View(shaftLocation));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var shaftLocation = await _context.ShaftLocations.FindAsync(id);

            if (shaftLocation == null)
            {
                return(NotFound());
            }
            ViewBag.NorthSouth = new SelectList(CardinalDirections.NorthSouth(), shaftLocation.North);
            ViewBag.EastWest   = new SelectList(CardinalDirections.EastWest(), shaftLocation.East);
            ViewBag.Subplots   = new SelectList(CardinalDirections.SubPlots(), shaftLocation.Subplot);
            return(View(shaftLocation));
        }