Ejemplo n.º 1
0
        public static async Task <IActionResult> DetachUser(
            [HttpTrigger(AuthorizationLevel.Function, "delete", Route = "detach")] HttpRequest req, ILogger logger)
        {
            var par = req.GetQueryParameterDictionary();

            if (!par.TryGetValue("userid", out var userid) || !par.TryGetValue("categoryid", out var categoryid))
            {
                errorcode = "Wrong parameter.";
                logger.LogError(errorcode);
                return(new BadRequestObjectResult(errorcode));
            }


            _removeEntity = new RemoveEntity();

            if (_removeEntity.DetachUserFromCategory(userid, categoryid, ref errorcode))
            {
                logger.LogInformation("Request succeed");
                return(new OkObjectResult("Category was removed from user."));
            }

            logger.LogError(errorcode);

            return(new BadRequestObjectResult(errorcode));
        }
Ejemplo n.º 2
0
        public static async Task <IActionResult> RemoveRecord(
            [HttpTrigger(AuthorizationLevel.Function, "delete", Route = "record")] HttpRequest req, ILogger logger)
        {
            var par = req.GetQueryParameterDictionary();

            if (!par.TryGetValue("transactionid", out var transactionid))
            {
                errorcode = "Wrong parameter.";
                logger.LogError(errorcode);
                return(new BadRequestObjectResult(errorcode));
            }

            _removeEntity = new RemoveEntity();

            if (!_removeEntity.RemoveTransaction(transactionid, ref errorcode))
            {
                logger.LogError(errorcode);
                return(new BadRequestObjectResult(errorcode));
            }

            logger.LogInformation("Request succeed");
            return(new OkObjectResult("Record was deleted."));
        }