public async Task <IActionResult> Migrate()
        {
            var userId = _validateHelper.GetUserId(HttpContext);

            if (userId != "13FAoQ4yNNSl7mUJtQgTQpFeWmU2")
            {
                return(Forbid());
            }

            await _context.Database.MigrateAsync();

            return(Ok());
        }
        public async Task <IActionResult> GetAllYears(long group)
        {
            var userId  = _validateHelper.GetUserId(HttpContext);
            var results = await _expenseService.GetAllYearsAsync(userId, group);

            return(Ok(results));
        }
示例#3
0
        public async Task <IActionResult> GetAll()
        {
            var userId  = _validateHelper.GetUserId(HttpContext);
            var results = await _groupService.GetAllAsync(userId);

            return(Ok(results));
        }
        public async Task <IActionResult> Post([FromBody] UserModel value)
        {
            var userId = _validateHelper.GetUserId(HttpContext);

            if (!userId.Equals(value.Id))
            {
                return(Forbid());
            }

            try
            {
                var model = await _userService.AddOrUpdateAsync(value);

                return(Ok(model));
            }
            catch (DbUpdateException e)
            {
                return(BadRequest(e));
            }
        }