Пример #1
0
 public ActionResult Edit([Bind(Include = "AxeId,Name,Attack,Handler,EnchantmentId")] Axe axe)
 {
     if (ModelState.IsValid)
     {
         db.Entry(axe).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.EnchantmentId = new SelectList(db.Enchantments, "EnchantmentId", "Element", axe.EnchantmentId);
     return(View(axe));
 }
Пример #2
0
 public bool AddAxe(Axe AxeItem)
 {
     if (AxeItem != null)
     {
         using (WeaponDb db = new WeaponDb())
         {
             db.Axes.Add(AxeItem);
             db.SaveChanges();
             return(true);
         }
     }
     return(false);
 }
Пример #3
0
 public bool AddAxe(AxeDTO AxeItem)
 {
     if (AxeItem != null)
     {
         Axe newAxe = ConverterDTOToModel.ConvertAxeDTOToAxeModel(AxeItem);
         using (WeaponDb db = new WeaponDb())
         {
             db.Axes.Add(newAxe);
             db.SaveChanges();
             return(true);
         }
     }
     return(false);
 }