public async Task <IActionResult> Upsert(ScientificClass obj) { if (ModelState.IsValid) { if (obj.Id == 0) { await _scRepository.CreateAsync(StaticNames.ScientificClassAPIPath, obj); } else { await _scRepository.UpdateAsync(StaticNames.ScientificClassAPIPath + obj.Id, obj); } return(RedirectToAction(nameof(Index))); } else { return(View(obj)); } }
public async Task <IActionResult> Upsert(int?id) { ScientificClass obj = new ScientificClass(); if (id == null) { //this will be true for create or insert return(View(obj)); } //this will be for update obj = await _scRepository.GetAsync(StaticNames.ScientificClassAPIPath, id.GetValueOrDefault()); if (obj == null) { return(NotFound()); } return(View(obj)); }
public bool UpdateScientificClass(ScientificClass scientificClass) { _context.ScientificClass.Update(scientificClass); return(Save()); }
public bool DeleteScientificClass(ScientificClass scientificClass) { _context.ScientificClass.Remove(scientificClass); return(Save()); }
public bool CrateScientificClass(ScientificClass scientificClass) { _context.ScientificClass.Add(scientificClass); return(Save()); }