예제 #1
0
        public async Task <IActionResult> PutItem(int ItemCotacaoId, Enviapreco model)
        {
            try
            {
                var cotacao = await CotacaoService.EnviarPrecooAsync(ItemCotacaoId, model);

                if (cotacao == null)
                {
                    return(BadRequest("Erro ao tentar Adicionar a cotacao."));
                }
                return(Ok(cotacao));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException.Message);
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Erro ao tentar adicionar Cotacao. Erro: {ex.Message}"));
            }
        }
예제 #2
0
        public async Task <ItemCotacao> EnviarPrecooAsync(int id, Enviapreco model)
        {
            var Itemcotacao = await _CotacaoPresist.GetAllItemCotacaoByIdAsync(id);

            if (Itemcotacao == null)
            {
                return(null);
            }

            Itemcotacao.PrecoUnit = model.preco;
            Itemcotacao.TotalItem = model.total;

            FGeralPersist.Update <ItemCotacao>(Itemcotacao);


            //  FGeralPersist.Update<SolicitacaoProduto>(sps);
            if (await FGeralPersist.SaveChangesAsync())
            {
                return(await _CotacaoPresist.GetAllItemCotacaoByIdAsync(id));
            }
            return(null);
        }