public async Task <ActionResult <int[]> > DeletePart([FromQuery] int position, [FromQuery] int[] productIds)
        {
            if (position <= 0 || position > productIds.Length)
            {
                return(BadRequest("The position is out of range."));
            }

            try
            {
                var result = await arrayCalcService.DeletePart(position, productIds);

                return(result);
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Exemplo n.º 2
0
        public void Delete_Null_Input_Test()
        {
            string result = _arrayCalcService.DeletePart(0, null);

            Assert.IsTrue(result == "[]");
        }