Ejemplo n.º 1
0
        public ActionResult Create(Course course)
        {
            if (ModelState.IsValid)
            {
                course.DateCreated = DateTime.Now;
                course.ModifiedByLogin = User.Identity.Name;
                course.CreatedByLogin = User.Identity.Name;

                _repo.Add(course);
                return RedirectToAction("Index");
            }

            ViewBag.IdCourseType = new SelectList(db.CourseTypes, "IdCourseType", "NameCourseType", course.IdCourseType);
            ViewBag.IdStatusValue = new SelectList(db.StatusValues, "IdStatusValue", "NameStatusValue", course.IdStatusValue);
            ViewBag.IdChartOfAccount = new SelectList(db.ChartOfAccounts, "IdChartOfAccount", "NumChartOfAccount", course.IdChartOfAccount);
            return View(course);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(Course course)
 {
     if (ModelState.IsValid)
     {
         _repo.Update(course);
         return RedirectToAction("Index");
     }
     ViewBag.IdCourseType = new SelectList(db.CourseTypes, "IdCourseType", "NameCourseType", course.IdCourseType);
     ViewBag.IdStatusValue = new SelectList(db.StatusValues, "IdStatusValue", "NameStatusValue", course.IdStatusValue);
     ViewBag.IdChartOfAccount = new SelectList(db.ChartOfAccounts, "IdChartOfAccount", "NumChartOfAccount", course.IdChartOfAccount);
     return View(course);
 }
Ejemplo n.º 3
0
 public void Remove(Course course)
 {
     _db.Courses.Remove(course);
     _db.SaveChanges();
 }
Ejemplo n.º 4
0
 public void Update(Course course)
 {
     _db.Entry(course).State = EntityState.Modified;
     _db.SaveChanges();
 }
Ejemplo n.º 5
0
 public void Add(Course course)
 {
     _db.Courses.Add(course);
     _db.SaveChanges();
 }