Ejemplo n.º 1
0
 public IActionResult Add(EditCourseViewModel vm)
 {
     if (ModelState.IsValid)
     {
         vm.Course.Instructor = context.Read(vm.UserId);
         context.AddCourse(vm.Course);
         return(RedirectToAction("Index"));
     }
     return(View(vm));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// IAction method for returning an edit view
        /// </summary>
        /// <param name="id">Id for a user</param>
        /// <returns></returns>
        public IActionResult Edit(string id)
        {
            var model = context.Read(id);

            return(View(model));
        }