public ActionResult DeleteConfirmed(long id)
        {
            PlanetRegionsPost planetregions = _planetregionsService.GetPost(id);

            planetregions.UserName = User.Identity.Name;
            _planetregionsService.Delete(planetregions);
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit([Bind("ixPlanetRegion,sPlanetRegion,ixPlanet")] PlanetRegionsPost planetregions)
        {
            if (ModelState.IsValid)
            {
                planetregions.UserName = User.Identity.Name;
                _planetregionsService.Edit(planetregions);
                return(RedirectToAction("Index"));
            }
            ViewBag.ixPlanet = new SelectList(_planetregionsService.selectPlanets().Select(x => new { x.ixPlanet, x.sPlanet }), "ixPlanet", "sPlanet", planetregions.ixPlanet);

            return(View(planetregions));
        }
        public ActionResult Edit(long id)
        {
            PlanetRegionsPost planetregions = _planetregionsService.GetPost(id);

            if (planetregions == null)
            {
                return(NotFound());
            }
            ViewBag.ixPlanet = new SelectList(_planetregionsService.selectPlanets().Select(x => new { x.ixPlanet, x.sPlanet }), "ixPlanet", "sPlanet", planetregions.ixPlanet);

            return(View(planetregions));
        }
Exemplo n.º 4
0
        public Task Delete(PlanetRegionsPost planetregionsPost)
        {
            // Additional validations

            // Pre-process

            // Process
            this._planetregionsRepository.RegisterDelete(planetregionsPost);
            try
            {
                this._planetregionsRepository.Commit();
            }
            catch (Exception ex)
            {
                this._planetregionsRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process

            return(Task.CompletedTask);
        }
Exemplo n.º 5
0
        public Task <Int64> Create(PlanetRegionsPost planetregionsPost)
        {
            // Additional validations

            // Pre-process

            // Process
            this._planetregionsRepository.RegisterCreate(planetregionsPost);
            try
            {
                this._planetregionsRepository.Commit();
            }
            catch (Exception ex)
            {
                this._planetregionsRepository.Rollback();
                // Log exception
                throw;
            }

            // Post-process

            return(Task.FromResult(planetregionsPost.ixPlanetRegion));
        }
 public void RegisterDelete(PlanetRegionsPost planetregionsPost)
 {
     _context.PlanetRegionsPost.Remove(planetregionsPost);
 }
 public void RegisterEdit(PlanetRegionsPost planetregionsPost)
 {
     _context.Entry(planetregionsPost).State = EntityState.Modified;
 }
 public void RegisterCreate(PlanetRegionsPost planetregionsPost)
 {
     _context.PlanetRegionsPost.Add(planetregionsPost);
 }