示例#1
0
        public async Task <IResultModel> Add(AreaAddModel model)
        {
            var entity = _mapper.Map <AreaEntity>(model);

            if (await _repository.Exists(entity))
            {
                return(ResultModel.HasExists);
            }

            var result = await _repository.AddAsync(entity);

            return(ResultModel.Result(result));
        }
示例#2
0
        public ActionResult AddAreaInfo(AreaAddModel model)
        {
            if (ModelState.IsValid)
            {
                var result = AreaBLL.AddAreaInfo(model, base.UserIDForLog);

                base.DoLog(OperationTypeEnum.Add, result, "AreaName:" + model.AreaName);
                return(Json(result));
            }
            else
            {
                return(PartialView("_AddAreaInfo", model));
            }
        }
示例#3
0
        public async Task <IResultModel> Add(AreaAddModel model)
        {
            var entity = _mapper.Map <AreaEntity>(model);

            if (await _repository.Exists(entity))
            {
                return(ResultModel.HasExists);
            }

            entity.Pinyin  = NPinyin.Pinyin.GetPinyin(entity.Name);
            entity.Jianpin = NPinyin.Pinyin.GetInitials(entity.Name);

            var result = await _repository.AddAsync(entity);

            return(ResultModel.Result(result));
        }
示例#4
0
文件: AreaBLL.cs 项目: SweetieXu/lhzw
        /// <summary>
        /// 新增区域信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static OperationResult AddAreaInfo(AreaAddModel model, int UserID)
        {
            List <SqlParameter> paras = new List <SqlParameter>();

            paras.Add(new SqlParameter()
            {
                ParameterName = "@areaName",
                SqlDbType     = SqlDbType.NVarChar,
                Size          = 20,
                Value         = model.AreaName.Trim(),
            });

            paras.Add(new SqlParameter("@description", SqlDbType.NVarChar, 50));
            paras.Add(new SqlParameter("@CreateUserID", SqlDbType.Int));
            if (string.IsNullOrWhiteSpace(model.Description))
            {
                paras[1].Value = DBNull.Value;
            }
            else
            {
                paras[1].Value = model.Description;
            }
            paras[2].Value = UserID;
            string sql = @"INSERT INTO dbo.Areas
        ( AreaName, Description,CreateUserID )
VALUES  ( @areaName,@description,@CreateUserID);";



            bool result = MSSQLHelper.ExecuteNonQuery(CommandType.Text, sql, paras.ToArray()) > 0;

            return(new OperationResult()
            {
                Success = result,
                Message = result ? PromptInformation.OperationSuccess : PromptInformation.DBError
            });
        }
示例#5
0
 public Task <IResultModel> Add(AreaAddModel model)
 {
     return(_service.Add(model));
 }