Пример #1
0
        public async Task <IActionResult> InitialStep(GuideRequest form)
        {
            if (ModelState.IsValid)
            {
                await Post <dynamic>("guide/create", form);

                return(RedirectToAction(nameof(Index), form));
            }

            return(RedirectToAction(nameof(InitialStep)));
        }
Пример #2
0
        public async Task Create(GuideRequest request)
        {
            // todo validate request

            var wallet = await _repoWallet.By(true, x => !x.IsDeleted && x.UserId == request.UserId);

            if (wallet is null)
            {
                wallet = new Wallet(request.UserId);
                await _repoWallet.Register(wallet);
            }

            await _repoReceipt.Register(new Receipt(request.Agency, request.Account, request.DateDue, wallet.Id));

            await _repoCompany.Register(new Company(request.Name, request.Email, request.SiteUri, request.CNPJ, null, request.Registration, DateTime.Now, request.UserId));

            await _ss.Create(new SiegeRequest {
                Description = request.Description, ImageUri = request.ImageUri, Latitude = 0, Longitude = 0, Seconds = 30, Visibility = request.Visibility,
                OperationIn = request.OperationIn, OperationTime = request.OperationTime, OwnerId = request.UserId, Range = request.Range, Title = request.Title,
            });
        }
        public async Task <IActionResult> Create([FromBody] GuideRequest request)
        {
            await _service.Create(request);

            return(Result(new BaseResponse()));
        }