コード例 #1
0
ファイル: AppController.cs プロジェクト: Drapyk/Unman-ship
        public ResponseResult AppAddTask(string taskName, string shipId, string routeId, string userId)
        {
            var        result     = ResponseResult.Default();
            AppService appService = new AppService();

            try
            {
                if (string.IsNullOrEmpty(taskName))
                {
                    return(ResponseResult.Error("taskId不能为空"));
                }
                if (string.IsNullOrEmpty(shipId))
                {
                    return(ResponseResult.Error("parameterId不能为空"));
                }
                if (string.IsNullOrEmpty(routeId))
                {
                    return(ResponseResult.Error("routeId不能为空"));
                }
                if (string.IsNullOrEmpty(userId))
                {
                    return(ResponseResult.Error("userId不能为空"));
                }
                else
                {
                    bool status = appService.AppAddTask(taskName, Convert.ToInt32(shipId), Convert.ToInt32(routeId), Convert.ToInt32(userId));
                    if (status == true)
                    {
                        return(ResponseResult.Success("添加成功"));
                    }
                    else
                    {
                        return(ResponseResult.Error("添加失败,同一用户下任务名不能重复"));
                    }
                }
            }
            catch (System.Exception ex)
            {
                result = ResponseResult.Error(ex.Message);
            }
            return(result);
        }