Exemple #1
0
        public Task <long> CreateConfigurarAmbiente(CreateConfigurarAmbienteCommand command)
        {
            var requestUrl = CreateRequestUri(string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                            $"{ResourceConfigurarAmbiente}/CreateConfigurarAmbiente"));

            return(Post(requestUrl, command));
        }
Exemple #2
0
        public async Task <ActionResult <long> > CreateConfigurarAmbiente(CreateConfigurarAmbienteCommand command)
        {
            try
            {
                var result = await Mediator.Send(command);

                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
        public ActionResult Create(IFormCollection collection)
        {
            try
            {
                var conf = ApiClientFactory.Instance.GetConfigurarAmbienteAll().FirstOrDefault();
                if (conf != null)
                {
                    var command = new UpdateConfigurarAmbienteCommand
                    {
                        CodConfigurarAmbiente         = conf.CodConfigurarAmbiente,
                        ParecerTecnico                = int.Parse(collection["ParecerTecnico"].ToString()),
                        DevolvidoParaComplemento      = int.Parse(collection["DevolvidoParaComplemento"].ToString()),
                        TempoNotificacaoParaResponder = int.Parse(collection["TempoNotificacaoParaResponder"].ToString()),
                        TextoMotivoCancelamento       = collection["TextoMotivoCancelamento"].ToString(),
                        AlteradoPor = User.Identity.Name
                    };
                    ApiClientFactory.Instance.UpdateConfigurarAmbiente(command);

                    return(RedirectToAction(nameof(Index), new { crud = (int)EnumCrud.Updated }));
                }
                else
                {
                    var command = new CreateConfigurarAmbienteCommand
                    {
                        ParecerTecnico                = int.Parse(collection["ParecerTecnico"].ToString()),
                        DevolvidoParaComplemento      = int.Parse(collection["DevolvidoParaComplemento"].ToString()),
                        TempoNotificacaoParaResponder =
                            int.Parse(collection["TempoNotificacaoParaResponder"].ToString()),
                        TextoMotivoCancelamento = collection["TextoMotivoCancelamento"].ToString(),
                        CriadoPor = User.Identity.Name
                    };
                    ApiClientFactory.Instance.CreateConfigurarAmbiente(command);

                    return(RedirectToAction(nameof(Index), new { crud = (int)EnumCrud.Created }));
                }
            }
            catch (Exception e)
            {
                return(View());
            }
        }