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

            ProficiencyDAO.Remove(proficiency);
            return(RedirectToAction("Index"));
        }
Exemple #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));
        }
Exemple #3
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));
        }