public ActionResult Create(TaskCategory newTaskCategory)
        {
            if (!ModelState.IsValid)
                return View();

            try
            {
                _dataModel.AddToTaskCategories(newTaskCategory);
                _dataModel.SaveChanges();

                return RedirectToAction("Index", "Task");
            }
            catch
            {
                return RedirectToAction("Index", "Task");
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Create a new TaskCategory object.
 /// </summary>
 /// <param name="name">Initial value of the Name property.</param>
 public static TaskCategory CreateTaskCategory(global::System.String name)
 {
     TaskCategory taskCategory = new TaskCategory();
     taskCategory.Name = name;
     return taskCategory;
 }
        public ActionResult Edit(string TaskCategoryName, TaskCategory taskCategory)
        {
            if (!ModelState.IsValid)
                return View();

            try
            {
                UpdateModel(GetTaskCategoryByName(TaskCategoryName));
                _dataModel.SaveChanges();
                return RedirectToAction("Index", "Task");
            }
            catch
            {
                return RedirectToAction("Index", "Task");
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the TaskCategories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTaskCategories(TaskCategory taskCategory)
 {
     base.AddObject("TaskCategories", taskCategory);
 }