Example #1
0
        public async Task <UserMoneyDetaleResponse> PostMonth(UserMoneyDetaleRequest userMoneyDetaleRequest, string userId)
        {
            //Maybe it's needed to add another auto mapper in the mvcInstaller
            MoneyDetale money = Mapper.Map <MoneyDetale>(userMoneyDetaleRequest);

            money.UserId = userId;
            money.Id     = Guid.NewGuid().ToString();
            await Context.MoneyDetale.AddAsync(money);

            await Context.SaveChangesAsync();

            UserMoneyDetaleResponse userMoneyDetaleResponse = Mapper.Map <UserMoneyDetaleResponse>(money);

            return(userMoneyDetaleResponse);
        }
Example #2
0
        [HttpPost(ApiRoutes.MoneyDetaleRoute.Post)] //ApiRoutes.MoneyDetaleRoute.Post
        public async Task <IActionResult> PostMonth([FromBody] UserMoneyDetaleRequest userMoneyDetaleRequest)
        {
            UserMoneyDetaleResponse userMoneyDetaleResponse = await MoneyService.PostMonth(userMoneyDetaleRequest, GeneralExtantions.GetUserId(HttpContext));

            return(Ok(userMoneyDetaleResponse));
        }