Exemplo n.º 1
0
 public ActionResult Delete(int id)
 {
     weapons = JsonSerializer.Deserialize <List <Infastructure.Entities.Weapon> >(HttpContext.Session.GetString("Cart"));
     Infastructure.Entities.Weapon weapon = weapons.Find(w => w.Id == id);
     weapons.Remove(weapon);
     HttpContext.Session.SetString("Cart", JsonSerializer.Serialize <List <Infastructure.Entities.Weapon> >(weapons));
     return(RedirectToAction("Index", "Cart"));
 }
Exemplo n.º 2
0
 protected override void Handle(Command request)
 {
     Infastructure.Entities.Weapon         weapon         = _context.Weapon.FirstOrDefault(x => x.Name == request.Name);
     Infastructure.Entities.Weapon_Feature weapon_Feature = _mapper.Map <Command, Infastructure.Entities.Weapon_Feature>(request);
     weapon_Feature.WeaponId = weapon.Id;
     _context.Features.Add(weapon_Feature);
     _context.SaveChanges();
 }
Exemplo n.º 3
0
 public ActionResult Index(int id)
 {
     Infastructure.Entities.Weapon weapon = _context.Weapon.Include(x => x.Weapon_Feature).FirstOrDefault(x => x.Id == id);
     return(View(weapon.Weapon_Feature));
 }