public ActionResult Index(FacultativeViewModel facultativeVM, Guid id, string button)
        {
            var teacher     = _teacherService.GetTeacher(_accountService.GetAccount(User.Identity.Name));
            var facultative = teacher.MyFacultatives.Where(s => s.Id == id).FirstOrDefault();

            facultative = _teacherService.GetFacultative(facultative);

            if (Request.HttpMethod == "POST")
            {
                if (button == "Change")
                {
                    foreach (var arg1 in facultative.GetType().GetProperties())
                    {
                        foreach (var arg2 in facultativeVM.GetType().GetProperties())
                        {
                            if (ModelState.IsValidField(arg1.Name) && arg1.Name == arg2.Name)
                            {
                                arg1.SetValue(facultative, arg2.GetValue(facultativeVM));
                            }
                        }
                    }
                    _teacherService.ChangeStateEntity(facultative);

                    return(RedirectToAction("Index", "TeacherFacultative"));
                }
                if (button == "Delete")
                {
                    _teacherService.DeleteFacultative(facultative);

                    return(RedirectToAction("Index", "TeacherFacultative"));
                }
            }

            return(View(facultativeVM));
        }
        public ActionResult Index(FacultativeViewModel model)
        {
            if (Request.HttpMethod == "POST")
            {
                if (ModelState.IsValid)
                {
                    Teacher teacher = _teacherService.GetTeacher(_accountService.GetAccount(User.Identity.Name));

                    _teacherService.AddFacultative(new Facultative(model.Name, model.Theme, model.Description
                                                                   , model.Status
                                                                   , teacher
                                                                   , model.StartFacultative
                                                                   , model.Duration), teacher);

                    return(RedirectToAction("Index", "TeacherFacultative"));
                }
            }

            return(View(model));
        }