Ejemplo n.º 1
0
        // Delete Project Class Look Up Page
        public ActionResult ProjectClassDelete(int id)
        {
            //find target by uid
            project_class target = db.project_class.First(s => s.class_number == id);

            //delete
            db.project_class.Remove(target);
            db.SaveChanges();

            return(RedirectToAction("ProjectClass"));
        }
Ejemplo n.º 2
0
        public ActionResult ProjectClassAdd(FormCollection form)
        {
            project_class target = new project_class();

            //get property
            TryUpdateModel(target, new string[] { "class_name" }, form.ToValueProvider());
            //validate
            if (string.IsNullOrEmpty(target.class_name))
            {
                ModelState.AddModelError("project_class_name", "Project class is required");
            }

            if (ModelState.IsValid)
            {
                db.project_class.Add(target);
                db.SaveChanges();
            }

            return(RedirectToAction("ProjectClass"));
        }