Ejemplo n.º 1
0
        public ActionResult CategoryEdit(WorkCategory workCategory)
        {
            db.Database.ExecuteSqlCommand("UPDATE WorkCategories SET Name = {0}, OrderBy = {1} WHERE WorkCategoryId = {2}", workCategory.Name, workCategory.OrderBy, workCategory.WorkCategoryId);

            return RedirectToAction("CategoryIndex");
            //if (ModelState.IsValid)
            //{
            //    db.Entry(workCategory).State = EntityState.Modified;
            //    db.SaveChanges();
            //    return RedirectToAction("CategoryIndex");
            //}

            //return View(workCategory);
        }
Ejemplo n.º 2
0
 public void UpdateCategoryGrid(WorkCategory workCategory)
 {
     db.Database.ExecuteSqlCommand("UPDATE WorkCategories SET Name = {0}, OrderBy = {1} WHERE WorkCategoryId = {2}", workCategory.Name, workCategory.OrderBy, workCategory.WorkCategoryId);
 }
Ejemplo n.º 3
0
        public ActionResult CategoryCreate(WorkCategory workCategory)
        {
            if (ModelState.IsValid)
            {
                db.Categories.Add(workCategory);
                db.SaveChanges();
                return RedirectToAction("CategoryIndex");
            }

            return View(workCategory);
        }