Exemple #1
0
        public void Update(UpdateAnnualPlanInput input)
        {
            var userId = _authInfoProvider.GetCurrent().User.Id;

            if (!_projectHelper.HasPermission("项目计划负责人", input.ProjectId))//权限设置
            {
                throw new AppCoreException("年计划修改没有权限");
            }
            var plan = input.MapTo <AnnualPlan>();

            if (plan.RecordDate == null)
            {
                throw new AppCoreException("传入数据的Year不能为空");
            }
            if (plan.ProjectId == 0)
            {
                throw new AppCoreException("传入数据的ProjectId不能为空");
            }
            if (_planRepository.Count(u => u.ProjectId == plan.ProjectId && u.RecordDate == plan.RecordDate && u.Id != plan.Id) > 0)
            {
                throw new EntityException("RecordDate", plan.RecordDate.ToString("yyyy"), "InvestmentAnnualPlan", "已存在");
            }
            _planRepository.Update(plan);
        }
Exemple #2
0
 public IActionResult Update(int id, [FromBody] UpdateAnnualPlanInput input)
 {
     input.Id = id;
     _planService.Update(input);
     return(Created("", new { id }));
 }