public async Task <IActionResult> Edit(int EntryId, [Bind("EntryId,BurialId,SampleNumber,MaximumCranialLength,MaximumCranialBreadth,BasionBregmaHeight,BasionNasion,BasionProsthionLength,BizygomaticDiameter,NasionProsthion,MaximumNasalBreadth,InterorbitalBreadth,SupraorbitalRidges,OrbitEdge,ParietalBossing,Gonian,NuchalCrest,ZygomaticCrest,CranialSuture,BasilarSuture,ForemanMagnum,ToothAttrition,ToothEruption,SkullTrauma,PostcraniaTrauma,CribraOrbitala,PoroticHyperostosis,PoroticHyperostosisLocations,MetopicSuture,ButtonOsteoma,TemporalMandibularJointOsteoarthritisTmjoa,LinearHypoplasiaEnamel,SkullYear,SkullMonth,SkullDate,Robust")] Cranial cranial) { if (EntryId != cranial.EntryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cranial); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CranialExists(cranial.EntryId)) { return(NotFound()); } else { throw; } } return(View("~/Views/Home/Confirmation.cshtml")); } ViewData["BurialId"] = new SelectList(_context.BurialRecords, "BurialId", "BurialId", cranial.BurialId); ViewData["EntryId"] = new SelectList(_context.MainEntries, "EntryId", "EntryId", cranial.EntryId); return(View(cranial)); }
public IActionResult AddCranial(Cranial c) { int cranialid = _context.Cranial.Select(x => x.CranialId).Max(); cranialid = cranialid + 1; ViewBag.SelectedPlot = 0; ViewBag.Plots = _context.Plot; ViewBag.Sublocation = _context.Sublocation; _context.Cranial.Add(new Cranial { CranialId = cranialid, BurialId = null, TubeNum = c.TubeNum, Description = c.Description, SizeMl = c.SizeMl, Foci = c.Foci, C14Sample2017 = c.C14Sample2017, Location = c.Location, Question = c.Question, Conventional14cAgeBp = c.Conventional14cAgeBp, _14cCalendarDate = c._14cCalendarDate, Calibrated95CalendarDateMax = c.Calibrated95CalendarDateMax, Calibrated95CalendarDateMin = c.Calibrated95CalendarDateMin, Calibrated95CalendarDateAvg = c.Calibrated95CalendarDateAvg, Calibrated95CalendarDateSpan = c.Calibrated95CalendarDateSpan, Category = c.Category, LabNotes = c.LabNotes }); _context.SaveChanges(); return(View("AddBurialSimple")); }
public async Task <IActionResult> Edit(int id, [Bind("CranialId,BurialFk,BurialLocation,SampleNumber,MaximumCranialLength,MaximumCranialBreadth,BasionBregmaHeight,BasionNasion,BasionProsthionLength,BizygomaticDiameter,NasionProsthion,MaximumNasalBreadth,InterorbitalBreadth,BurialPositioningNorthSouthNumber,BurialPositioningNorthSouthDirection,BurialPositioningEastWestNumber,BurialPositioningEastWestDirection,BurialNumber,BurialDepth,BurialSubPlotDirection,BurialArtifactDescription,BuriedWithArtifacts,GilesGender,BodyGender")] Cranial cranial) { if (id != cranial.CranialId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cranial); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CranialExists(cranial.CranialId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BurialFk"] = new SelectList(_context.Burial, "BurialId", "BurialId", cranial.BurialFk); return(View(cranial)); }
//return view to edit cranial data public IActionResult Edit(int id) { Cranial cranialSample = _context.Cranials .Where(x => x.Id == id).FirstOrDefault(); if (cranialSample == null) { return(NotFound()); } return(View(cranialSample)); }
public async Task <IActionResult> Create([Bind("CranialId,BurialFk,BurialLocation,SampleNumber,MaximumCranialLength,MaximumCranialBreadth,BasionBregmaHeight,BasionNasion,BasionProsthionLength,BizygomaticDiameter,NasionProsthion,MaximumNasalBreadth,InterorbitalBreadth,BurialPositioningNorthSouthNumber,BurialPositioningNorthSouthDirection,BurialPositioningEastWestNumber,BurialPositioningEastWestDirection,BurialNumber,BurialDepth,BurialSubPlotDirection,BurialArtifactDescription,BuriedWithArtifacts,GilesGender,BodyGender")] Cranial cranial) { if (ModelState.IsValid) { _context.Add(cranial); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BurialFk"] = new SelectList(_context.Burial, "BurialId", "BurialId", cranial.BurialFk); return(View(cranial)); }
public ActionResult <Cranial> GetCranial(int id) { Cranial obj = _context.Cranial.Where(e => e.BurialId == id).FirstOrDefault(); if (obj is null) { obj = new Cranial { BurialId = id }; } return(obj); }
public IActionResult CustomDelete(int id) { Cranial cranial = _context.Cranials.Where(x => x.Id == id).FirstOrDefault(); _context.Cranials.Remove(cranial); _context.SaveChanges(); return(View("RecordDetails", new CranialViewModel() { cranialSamples = _context.Cranials .Where(x => x.BurialId == cranial.BurialId), burial = _context.Burials .Where(x => x.BurialId == cranial.BurialId).FirstOrDefault() })); }
// Edit cranial data in database public IActionResult CustomEdit(Cranial cranialSample) { if (ModelState.IsValid) { _context.Update(cranialSample); _context.SaveChanges(); return(View("RecordDetails", new CranialViewModel { cranialSamples = _context.Cranials.Where(x => x.BurialId == cranialSample.BurialId), burial = _context.Burials.Where(x => x.BurialId == cranialSample.BurialId).FirstOrDefault(), cranialSample = cranialSample })); } return(View(cranialSample)); }
public IActionResult EnterCranial(Cranial c) { var craid = context.Cranial.Skip(context.Cranial.Count() - 1).Take(1).FirstOrDefault().CranialId; craid++; c.CranialId = craid; //first check data to make sure it's good before passing to Model and DB if (ModelState.IsValid) { NewMummy.body.CranialId = c.CranialId; NewMummy.cranial = c; //Update Database context.Cranial.Add(c); context.SaveChanges(); return(View("EnterTablesMenuPage", NewMummy)); } //Otherwise return(View()); }
public IActionResult EditCranial2(Cranial c, int CranialID) { if (ModelState.IsValid) { var cran = context.Cranial.SingleOrDefault(x => x.CranialId == c.CranialId); context.Entry(cran).Property(x => x.MaxCranialLength).CurrentValue = c.MaxCranialLength; context.Entry(cran).Property(x => x.SkullTrauma).CurrentValue = c.SkullTrauma; context.Entry(cran).Property(x => x.MaxCranialBreadth).CurrentValue = c.MaxCranialBreadth; context.Entry(cran).Property(x => x.BasionBergmaHeight).CurrentValue = c.BasionBergmaHeight; context.Entry(cran).Property(x => x.BasionNasion).CurrentValue = c.BasionNasion; context.Entry(cran).Property(x => x.BasionProsithanLength).CurrentValue = c.BasionProsithanLength; context.Entry(cran).Property(x => x.BizgoymaticDiameter).CurrentValue = c.BizgoymaticDiameter; context.Entry(cran).Property(x => x.NasionProsthion).CurrentValue = c.NasionProsthion; context.Entry(cran).Property(x => x.MaxNasalBreadth).CurrentValue = c.MaxNasalBreadth; context.Entry(cran).Property(x => x.InterorbitalBreadth).CurrentValue = c.InterorbitalBreadth; context.Entry(cran).Property(x => x.YearOnSkull).CurrentValue = c.YearOnSkull; context.Entry(cran).Property(x => x.MonthOnSkull).CurrentValue = c.MonthOnSkull; context.Entry(cran).Property(x => x.SkullAtMagazine).CurrentValue = c.SkullAtMagazine; context.Entry(cran).Property(x => x.CribraOrbitalia).CurrentValue = c.CribraOrbitalia; context.Entry(cran).Property(x => x.PoroticHyperostosis).CurrentValue = c.PoroticHyperostosis; context.Entry(cran).Property(x => x.PoroticHyperostosisLoc).CurrentValue = c.PoroticHyperostosisLoc; context.Entry(cran).Property(x => x.MetopicSuture).CurrentValue = c.MetopicSuture; context.Entry(cran).Property(x => x.ButtonOsteoma).CurrentValue = c.ButtonOsteoma; context.Entry(cran).Property(x => x.OsteologyUnknownComment).CurrentValue = c.OsteologyUnknownComment; context.Entry(cran).Property(x => x.Tmjoa).CurrentValue = c.Tmjoa; context.Entry(cran).Property(x => x.CranialSuture).CurrentValue = c.CranialSuture; context.Entry(cran).Property(x => x.GefunctionTotal).CurrentValue = c.GefunctionTotal; context.SaveChanges(); return(RedirectToAction("BurialList")); } else { return(View()); } }
public IActionResult RecordDetails(string id) { string newid = id.Replace("%2F", "/"); if (newid == null) { return(NotFound()); } Burial burial = _context.Burials.Where(x => x.BurialId == newid).FirstOrDefault(); Cranial cranialSample = _context.Cranials.Where(x => x.BurialId == burial.BurialId).FirstOrDefault(); IEnumerable <Cranial> cranials = _context.Cranials.Where(x => x.BurialId == burial.BurialId); return(View(new CranialViewModel() { cranialSamples = cranials, cranialSample = cranialSample, burial = burial })); }
public IActionResult EditCranial(int CranialID) { Cranial c = context.Cranial.Single(x => x.CranialId == CranialID); return(View("EditCranial", c)); }