public ActionResult DeleteConfirmed(long id) { PlanetsPost planets = _planetsService.GetPost(id); planets.UserName = User.Identity.Name; _planetsService.Delete(planets); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind("ixPlanet,sPlanet,ixPlanetarySystem")] PlanetsPost planets) { if (ModelState.IsValid) { planets.UserName = User.Identity.Name; _planetsService.Edit(planets); return(RedirectToAction("Index")); } ViewBag.ixPlanetarySystem = new SelectList(_planetsService.selectPlanetarySystems().Select(x => new { x.ixPlanetarySystem, x.sPlanetarySystem }), "ixPlanetarySystem", "sPlanetarySystem", planets.ixPlanetarySystem); return(View(planets)); }
public ActionResult Edit(long id) { PlanetsPost planets = _planetsService.GetPost(id); if (planets == null) { return(NotFound()); } ViewBag.ixPlanetarySystem = new SelectList(_planetsService.selectPlanetarySystems().Select(x => new { x.ixPlanetarySystem, x.sPlanetarySystem }), "ixPlanetarySystem", "sPlanetarySystem", planets.ixPlanetarySystem); return(View(planets)); }
public Task Delete(PlanetsPost planetsPost) { // Additional validations // Pre-process // Process this._planetsRepository.RegisterDelete(planetsPost); try { this._planetsRepository.Commit(); } catch (Exception ex) { this._planetsRepository.Rollback(); // Log exception throw; } // Post-process return(Task.CompletedTask); }
public Task <Int64> Create(PlanetsPost planetsPost) { // Additional validations // Pre-process // Process this._planetsRepository.RegisterCreate(planetsPost); try { this._planetsRepository.Commit(); } catch (Exception ex) { this._planetsRepository.Rollback(); // Log exception throw; } // Post-process return(Task.FromResult(planetsPost.ixPlanet)); }
public void RegisterDelete(PlanetsPost planetsPost) { _context.PlanetsPost.Remove(planetsPost); }
public void RegisterEdit(PlanetsPost planetsPost) { _context.Entry(planetsPost).State = EntityState.Modified; }
public void RegisterCreate(PlanetsPost planetsPost) { _context.PlanetsPost.Add(planetsPost); }