示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("ImageId,BurialId,BurialSquareId,BurialSubplot,CranialId,Image1,ImageDescription")] Image image)
        {
            if (id != image.ImageId)
            {
                return(NotFound());
            }



            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(image);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ImageExists(image.ImageId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            var role = (mummyContext.UserRoles
                        .Where(r => r.UserId == userManager.GetUserId(User))
                        .FirstOrDefault());



            if (!(role is null))
            {
                ViewBag.Role = Int32.Parse(role.RoleId);
            }

            ViewData["BurialId"]       = new SelectList(_context.Burial, "BurialId", "BurialWrapping", image.BurialId);
            ViewData["BurialSubplot"]  = new SelectList(_context.BurialQuadrant, "BurialSubplot", "BurialSubplot", image.BurialSubplot);
            ViewData["BurialSquareId"] = new SelectList(_context.BurialSquare, "BurialSquareId", "BurialSquareId", image.BurialSquareId);
            ViewData["CranialId"]      = new SelectList(_context.CranialSample, "CranialId", "CranialId", image.CranialId);
            return(View(image));
        }
示例#2
0
        public async Task <IActionResult> Edit(string RackNumber, string RackShelf, [Bind("RackShelf,RackNumber,IsBag,BurialId,TubeNumber,RankDescription,MlSize,Foci,LocationNotes,Questions,Conventional14cAgeBp,_14cCalendarDay,Calibrated95CalendarDateMax,Calibrated95CalendarDateMin,Calibrated95CalendarDateSpan,Calibrated95CalendarDateAvg,Category,Notes")] RackSample rackSample)
        {
            if (RackShelf != rackSample.RackShelf || RackNumber != rackSample.RackNumber)
            {
                return(NotFound());
            }



            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rackSample);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RackSampleExists(rackSample.RackShelf))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            var role = (mummyContext.UserRoles
                        .Where(r => r.UserId == userManager.GetUserId(User))
                        .FirstOrDefault());



            if (!(role is null))
            {
                ViewBag.Role = Int32.Parse(role.RoleId);
            }
            ViewData["BurialId"] = new SelectList(_context.Burial, "BurialId", "BurialWrapping", rackSample.BurialId);
            return(View(rackSample));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CranialId,BurialId,SampleNumber,RackShelf,RackNumber,MaxCranialLength,MaxCranialBreadth,BasionBregmaHeight,BasionNasion,BasionProsthionLength,BizgomaticDiameter,NasionProsthion,MaxNasalBreadth,InterobitalBreadth")] CranialSample cranialSample)
        {
            if (id != cranialSample.CranialId)
            {
                return(NotFound());
            }



            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cranialSample);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CranialSampleExists(cranialSample.CranialId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            var role = (mumContext.UserRoles
                        .Where(r => r.UserId == userManager.GetUserId(User))
                        .FirstOrDefault());

            if (!(role is null))
            {
                ViewBag.Role = Int32.Parse(role.RoleId);
            }

            ViewData["BurialId"]  = new SelectList(_context.Burial, "BurialId", "BurialWrapping", cranialSample.BurialId);
            ViewData["RackShelf"] = new SelectList(_context.RackSample, "RackShelf", "RackShelf", cranialSample.RackShelf);
            return(View(cranialSample));
        }
示例#4
0
        public async Task <IActionResult> Edit(string id, [Bind("BurialSquareId,BurialLocationNs,BurialLocationEw,LowPairNs,HighPairNs,LowPairEw,HighPairEw")] BurialSquare burialSquare)
        {
            id = id.Replace("F", "/");
            burialSquare.BurialSquareId = burialSquare.BurialSquareId.Replace("F", "/");


            if (id != burialSquare.BurialSquareId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(burialSquare);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BurialSquareExists(burialSquare.BurialSquareId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            var role = (mummyContext.UserRoles
                        .Where(r => r.UserId == userManager.GetUserId(User))
                        .FirstOrDefault());

            if (!(role is null))
            {
                ViewBag.Role = Int32.Parse(role.RoleId);
            }
            return(View(burialSquare));
        }