예제 #1
0
        public string CreateDispatch(int id)
        {
            GenericView view = new GenericView();
            DispatchRepository dispatchRepo = new DispatchRepository();

            Validator validator = new Validator();
            if (!validator.MatchRule(id + "", "required", "id"))
            {
                return view.Error(validator.GetDetail());
            }

            bool Ret = dispatchRepo.JoinCourse(Auth.User().Id, id);

            return Ret ? view.Success() : view.Error();
        }
예제 #2
0
        public string RemoveDispatch(string id)
        {
            GenericView view = new GenericView();
            DispatchRepository dispatchRepo = new DispatchRepository();

            Validator validator = new Validator();
            if (!validator.MatchRule(id, "required", "id"))
            {
                return view.Error(validator.GetDetail());
            }

            string[] idArr = id.Split(',');
            bool Ret = dispatchRepo.RemoveCourseList(Auth.User().Id, Array.ConvertAll(idArr, int.Parse));

            return Ret ? view.Success() : view.Error();
        }