コード例 #1
0
        public int AddRectification(int problemId, AddSafetyProblemRectificationInput input)
        {
            var existing      = _problemRepository.Get().Where(u => u.Id == problemId).FirstOrDefault();
            var rectification = input.MapTo <SafetyProblemRectification>();

            rectification.SafetyProblemId = problemId;
            using (var transaction = _dbContextProvider.BeginTransaction())
            {
                _problemRepository.Update(
                    new SafetyProblem
                {
                    Id = problemId,
                    RectificationState = RectificationState.Underway,
                    CompletionTime     = null
                },
                    new System.Linq.Expressions.Expression <Func <SafetyProblem, object> >[] { u => u.RectificationState, u => u.CompletionTime });
                _rectificationRepository.Add(rectification);
                transaction.Commit();
            }
            AppBaseContext.Instance.Produce("add-project-briefing", JsonConvert.SerializeObject(new
            {
                TenantId  = _op.TenantId,
                ProjectId = existing.ProjectId
            }));
            return(rectification.Id);
        }
コード例 #2
0
        public IActionResult AddRectification(int id, [FromBody] AddSafetyProblemRectificationInput rectificationInput)
        {
            var rectificationId = _problemService.AddRectification(id, rectificationInput);

            return(Created("", new { rectificationId }));
        }