Esempio n. 1
0
        public Task <long> CreateSubLocal(CreateSubLocalCommand command)
        {
            var requestUrl = CreateRequestUri(string.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                            $"{ResourceSubLocal}/CreateSubLocal"));

            return(Post(requestUrl, command));
        }
        public async Task <ActionResult <long> > CreateSubLocal(CreateSubLocalCommand command)
        {
            try
            {
                var result = await Mediator.Send(command);

                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
        public ActionResult Create(IFormCollection collection)
        {
            try
            {
                var command = new CreateSubLocalCommand
                {
                    CodUnidadeInfraestrutura = int.Parse(collection["ddlUnidadeInfraestrutura"].ToString()),
                    CodLocal    = int.Parse(collection["ddlLocal"].ToString()),
                    DscSubLocal = collection["DscSubLocal"].ToString(),
                    CriadoPor   = User.Identity.Name
                };
                ApiClientFactory.Instance.CreateSubLocal(command);

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