public async Task <IActionResult> Edit(int id, [Bind("BioSampleId,RackNum,BagNum,ShaftId,BurialNum,MummyId,ClusterNum,Notes,Initials,SampledMonth,SampledDay,SampledYear,PreviouslySampled")] BiologicalSample biologicalSample)
        {
            if (id != biologicalSample.BioSampleId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(biologicalSample);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BiologicalSampleExists(biologicalSample.BioSampleId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MummyId"] = new SelectList(_context.Mummies, "MummyId", "MummyId", biologicalSample.MummyId);
            ViewData["ShaftId"] = new SelectList(_context.ShaftLocations, "ShaftId", "ShaftId", biologicalSample.ShaftId);
            return(View(biologicalSample));
        }
Example #2
0
 public IActionResult AddBioSample(BiologicalSample bs)
 {
     bs.BurialId = (int)TempData["BurialId"];
     context.BiologicalSample.Add(bs);
     context.SaveChanges();
     return(RedirectToAction("BiologicalSample", new { BurialId = bs.BurialId }));
 }
Example #3
0
        public async Task <IActionResult> Edit(decimal id, [Bind("BiologicalSampleId,BurialId,Description,SampleRack,SampleBag,PreviouslySampled,Initials")] BiologicalSample biologicalSample)
        {
            if (id != biologicalSample.BiologicalSampleId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(biologicalSample);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BiologicalSampleExists(biologicalSample.BiologicalSampleId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BurialId"] = new SelectList(_context.Burials, "BurialId", "BurialId", biologicalSample.BurialId);
            return(View(biologicalSample));
        }
        public async Task <IActionResult> Edit(int id, [Bind("BiologicalId,RackNumber,BagNumber,BurialId,LowPairNs,HighPairNs,BurialLocationNs,LowPairEw,HighPairEw,BurialLocationEw,BurialSubplot,BurialNumber,ClusterNumber,Date,PreviouslySampled,Notes,Initials,Column17")] BiologicalSample biologicalSample)
        {
            if (id != biologicalSample.BiologicalId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(biologicalSample);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BiologicalSampleExists(biologicalSample.BiologicalId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(biologicalSample));
        }
Example #5
0
        public IActionResult DeleteBioSample(int BioId)
        {
            BiologicalSample bs = context.BiologicalSample.Single(bio => bio.BioSampleId == BioId);

            context.BiologicalSample.Remove(bs);
            context.SaveChanges();
            return(RedirectToAction("BiologicalSample", new { BurialId = bs.BurialId }));
        }
        public async Task <IActionResult> Create([Bind("BiologicalId,RackNumber,BagNumber,BurialId,LowPairNs,HighPairNs,BurialLocationNs,LowPairEw,HighPairEw,BurialLocationEw,BurialSubplot,BurialNumber,ClusterNumber,Date,PreviouslySampled,Notes,Initials,Column17")] BiologicalSample biologicalSample)
        {
            if (ModelState.IsValid)
            {
                _context.Add(biologicalSample);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", "Burials"));
            }
            return(View(biologicalSample));
        }
        public IActionResult BiologicalSampleDelete(int bsid)
        {
            BiologicalSample samp = _BurialContext.BiologicalSamples.Find(bsid);
            int bid = samp.Burial;

            _BurialContext.Remove(samp);
            _BurialContext.SaveChanges();
            Burial bob = _BurialContext.Burials.Find(bid);

            return(View("Success", bob));
        }
Example #8
0
        public async Task <IActionResult> Create([Bind("BiologicalSampleId,BurialId,Description,SampleRack,SampleBag,PreviouslySampled,Initials")] BiologicalSample biologicalSample)
        {
            if (ModelState.IsValid)
            {
                _context.Add(biologicalSample);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BurialId"] = new SelectList(_context.Burials, "BurialId", "BurialId", biologicalSample.BurialId);
            return(View(biologicalSample));
        }
Example #9
0
        public IActionResult EditBioSample(BiologicalSample bs)
        {
            BiologicalSample newB = context.BiologicalSample.Single(b => b.BioSampleId == bs.BioSampleId);

            newB.RackNum           = bs.RackNum;
            newB.BagNum            = bs.BagNum;
            newB.PreviouslySampled = bs.PreviouslySampled;
            newB.Notes             = bs.Notes;
            newB.Initials          = bs.Initials;
            context.SaveChanges();
            return(RedirectToAction("BiologicalSample", new { BurialId = bs.BurialId }));
        }
        // Return a form to edit Bio sample
        public IActionResult Edit(int id)
        {
            BiologicalSample biologicalSample = _context.BiologicalSamples
                                                .Where(x => x.Id == id).FirstOrDefault();

            if (biologicalSample == null)
            {
                return(NotFound());
            }

            return(View(biologicalSample));
        }
        public async Task <IActionResult> Create([Bind("BioSampleId,RackNum,BagNum,ShaftId,BurialNum,MummyId,ClusterNum,Notes,Initials,SampledMonth,SampledDay,SampledYear,PreviouslySampled")] BiologicalSample biologicalSample)
        {
            if (ModelState.IsValid)
            {
                _context.Add(biologicalSample);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MummyId"] = new SelectList(_context.Mummies, "MummyId", "MummyId", biologicalSample.MummyId);
            ViewData["ShaftId"] = new SelectList(_context.ShaftLocations, "ShaftId", "ShaftId", biologicalSample.ShaftId);
            return(View(biologicalSample));
        }
Example #12
0
        public IActionResult OnPost(BiologicalSample bioSample)
        {
            // if the artifact object is valid, save it to the db context
            if (ModelState.IsValid)
            {
                context.BiologicalSamples.Add(bioSample);
                context.SaveChanges();

                return(RedirectToPage("./BioSampleConfirmation", bioSample));
            }
            else
            {
                return(Page());
            }
        }
        public IActionResult CustomEdit(BiologicalSample bio)
        {
            if (ModelState.IsValid)
            {
                _context.Update(bio);
                _context.SaveChanges();

                return(View("RecordSpecificIndex", new BioSampleViewModel
                {
                    biologicalSamples = _context.BiologicalSamples.Where(x => x.BurialId == bio.BurialId),

                    burial = _context.Burials.Where(x => x.BurialId == bio.BurialId).FirstOrDefault(),

                    bioSample = bio
                }));
            }
            return(View(bio));
        }
        public IActionResult CustomCreate([Bind("BurialId,Rack,F3,Bag,LowNs,HighNs,NorthOrSouth,LowEw,HighEw,EastOrWest,Area,BurialNumber,ClusterNumber,Date,PreviouslySampled,Notes,Initials,Id")] BiologicalSample bio)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bio);
                _context.SaveChanges();

                return(View("RecordSpecificIndex", new BioSampleViewModel
                {
                    biologicalSamples = _context.BiologicalSamples.Where(x => x.BurialId == bio.BurialId),

                    burial = _context.Burials.Where(x => x.BurialId == bio.BurialId).FirstOrDefault(),

                    bioSample = bio
                }));
            }

            ViewData["BurialId"] = new SelectList(_context.Burials, "BurialId", "BurialId", bio.BurialId);
            return(View(bio));
        }
 public IActionResult BiologicalSampleEdit(BiologicalSample biologicalSample)
 {
     _BurialContext.BiologicalSamples.Update(biologicalSample);
     _BurialContext.SaveChanges();
     return(View("Success", _BurialContext.Burials.Where(b => b.BurialID == biologicalSample.Burial).FirstOrDefault()));
 }