public ActionResult Edit([Bind(Include = "ItemId,Name,Description,RequiredLevel,Price,ItemRarity,Damage,Critical")] Weapon weapon)
        {
            weapon.ItemRarity = ItemRarityDAO.Get(weapon.ItemRarity.ItemRarityId);

            if (ModelState.IsValid)
            {
                Weapon weaponInDataBase = WeaponDAO.Get(weapon.ItemId);
                weaponInDataBase.Name          = weapon.Name;
                weaponInDataBase.ItemRarity    = weapon.ItemRarity;
                weaponInDataBase.Price         = weapon.Price;
                weaponInDataBase.RequiredLevel = weapon.RequiredLevel;
                weaponInDataBase.Description   = weapon.Description;
                weaponInDataBase.Damage        = weapon.Damage;
                weaponInDataBase.Critical      = weapon.Critical;

                WeaponDAO.Update(weaponInDataBase);

                return(RedirectToAction("Index"));
            }

            if (weapon.ItemRarity == null)
            {
                ModelState.AddModelError("error", "Necessário selecionar a raridade do item");
            }

            ViewBag.ItemRarity = new SelectList(ItemRarityDAO.GetAll(), "ItemRarityId", "Name");
            return(View(weapon));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Weapon weapon = WeaponDAO.Get(id);

            FileUploadHandling.RemoveFile(weapon.Image);
            WeaponDAO.Remove(weapon);
            return(RedirectToAction("Index"));
        }
        // GET: Weapons/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Weapon weapon = WeaponDAO.Get(id);

            if (weapon == null)
            {
                return(HttpNotFound());
            }
            return(View(weapon));
        }
        // GET: Weapons/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Weapon weapon = WeaponDAO.Get(id);

            if (weapon == null)
            {
                return(HttpNotFound());
            }

            ViewBag.ItemRarity = new SelectList(ItemRarityDAO.GetAll(), "ItemRarityId", "Name");
            return(View(weapon));
        }