예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Proficiency proficiency = ProficiencyDAO.Get(id);

            ProficiencyDAO.Remove(proficiency);
            return(RedirectToAction("Index"));
        }
예제 #2
0
        // GET: Proficiencies/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Proficiency proficiency = ProficiencyDAO.Get(id);

            if (proficiency == null)
            {
                return(HttpNotFound());
            }
            return(View(proficiency));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "ProficiencyId,Name")] Proficiency proficiency)
        {
            if (ModelState.IsValid)
            {
                if (ProficiencyDAO.Save(proficiency))
                {
                    return(RedirectToAction("Index"));
                }

                ModelState.AddModelError("error", "A proficiencia já existe");
            }

            return(View(proficiency));
        }
예제 #4
0
        public ActionResult Edit([Bind(Include = "ProficiencyId,Name")] Proficiency proficiency)
        {
            if (ModelState.IsValid)
            {
                Proficiency proficiencyInDataBase = ProficiencyDAO.Get(proficiency.ProficiencyId);

                proficiencyInDataBase.Name = proficiency.Name;

                if (ProficiencyDAO.Update(proficiencyInDataBase))
                {
                    return(RedirectToAction("Index"));
                }
                ModelState.AddModelError("error", "A proficiencia já existe");
            }
            return(View(proficiency));
        }
예제 #5
0
 // GET: Proficiencies
 public ActionResult Index()
 {
     return(View(ProficiencyDAO.GetAll()));
 }
 private List <AttributeInCharacter> CreateAttributesToAnCharacter()
 {
     return(ProficiencyDAO.GetAll().ConvertAll(x => new AttributeInCharacter(x)));
 }