Ejemplo n.º 1
0
 public ActionResult Destroy([Bind(Include = "Id,Number,Name")] BuildDestroyViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         ApplicationUser user   = userRepository.GetUser(User.Identity.GetUserId());
         Island          island = islandRepository.GetIsland(viewModel.Id);
         if (island != null && island.Property.Player.Id == user.Id)
         {
             CyclicProduct.CalculateGame(island.Game.Id);
             island.Destroy(viewModel.Name, viewModel.Number);
             gameRepository.Save();
         }
     }
     return(RedirectToAction("Island", new { id = viewModel.Id }));
 }