Esempio n. 1
0
 /// <summary>
 /// 添加课程
 /// </summary>
 /// <param name="args"></param>
 /// <returns></returns>
 public CommandResult <int> AddCourse(AddCourseArgs args)
 {
     ArgumentHelper.Require(args.SchoolId, "SchoolId", Arguments.Positive);
     ArgumentHelper.Require(args.CourseTypeId, "CourseTypeId", Arguments.Positive);
     ArgumentHelper.Require(args.CourseName, "CourseName", Arguments.NotEmptyOrWhitespace);
     ArgumentHelper.Require(args.CreateBy, "CreateBy", Arguments.Positive);
     ArgumentHelper.Require(args.ModifyBy, "ModifyBy", Arguments.Positive);
     return(ContainerFactory <ICourseRepository> .Instance.AddCourse(args));
 }
Esempio n. 2
0
        public string AddCourse(AddCourseArgs model)
        {
            if (model != null)
            {
                model.CreateBy = ApplicationContext.UserId;
                model.ModifyBy = ApplicationContext.UserId;
                model.SchoolId = ApplicationContext.SchoolId;

                var result = CourseService.Instance.AddCourse(model);
                return(JsonHelper.Serialize(result));
            }
            return(JsonHelper.Serialize(CommandResult.Failure <int>()));
        }
Esempio n. 3
0
        public CommandResult <int> AddCourse(AddCourseArgs args)
        {
            try
            {
                var result = ContainerFactory <ISqlExcuteContext> .Instance.ExcuteQueryProcedure <int>(1, "add_course", args);

                if (result.Code == 200 && result.Items.Count > 0)
                {
                    return(CommandResult.Success(result.Items[0]));
                }
                return(CommandResult.Failure <int>());
            }
            catch (Exception e)
            {
                LogHelper.Error(this.GetType(), "课程管理-添加课程,SchoolId:" + args.SchoolId + ",学校编号:" + args.SchoolId, e);
                return(CommandResult.Failure <int>(e.ToString()));
            }
        }