Пример #1
0
        public async Task <ICommandResult> Handler(UpdateConstructionCommandInput command)
        {
            var construction = _OREP.GetById(command.ConstructionId);
            var residente    = _RREP.GetByCREA(command.ResidentCrea);
            var fiscal1      = _RREP.GetByCREA(command.Fiscal1Crea);
            var fiscal2      = _RREP.GetByCREA(command.Fiscal2Crea);
            await Task.WhenAll(construction, residente, fiscal1, fiscal2);

            construction.Result.OptionalInformation(command.Image, residente.Result, fiscal1.Result, fiscal2.Result);
            construction.Result.Update(command.Name, command.Image, command.FinalDate);

            if (construction.Result.Invalid)
            {
                return(new CommandResult(_BuildResult.BuildResult(construction.Result.Notifications)));
            }

            await AddResponsaveis(command.creas, construction.Result);

            _OREP.Update(construction.Result);

            return(new CommandResult(new string[] { "Projeto de Construction Editado com Sucesso !" }));
        }
        public async Task <ICommandResult> Put([FromBody] UpdateConstructionCommandInput value)
        {
            var result = await ConstructionHandler.Handler(value);

            return(result);
        }