Esempio n. 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (LeftParam != null ? LeftParam.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RightParam != null ? RightParam.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Function.GetHashCode();
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Fn != null ? Fn.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public async Task <ApiRequestResult> UpdateAsync([FromBody] RightParam param)
        {
            try
            {
                var tRight = await _iTRightRepository.GetAsync(c => c.Id == param.Id);

                tRight = param.EntityMap <TRight, RightParam>(tRight);
                await _iTRightRepository.UpdateAsync(tRight);

                return(ApiRequestResult.Success("修改成功"));
            }
            catch (Exception ex)
            {
                return(ApiRequestResult.Error(ex.Message));
            }
        }
        public async Task <ApiRequestResult> AddAsync([FromBody] RightParam param)
        {
            try
            {
                var add = new TRight
                {
                    RightName   = param.RightName,
                    ParentId    = param.ParentId,
                    Description = param.Description,
                    RightIcon   = param.RightIcon,
                    RightUrl    = param.RightUrl,
                };
                await _iTRightRepository.AddAsync(add);

                return(ApiRequestResult.Success("添加成功"));
            }
            catch (Exception ex)
            {
                return(ApiRequestResult.Error(ex.Message));
            }
        }