Пример #1
0
        public async Task DeleteLabelTest()
        {
            int result = await _labelContract.DeleteLabel(1, 1);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result);
        }
Пример #2
0
        public async Task <IActionResult> DeleteLabel([Required] long id)
        {
            long userId      = long.Parse(HttpContext.Items["UserId"].ToString());
            int  deletedItem = await _labelContract.DeleteLabel(id, userId);

            if (deletedItem == 1)
            {
                return(Ok(
                           new ApiResponse <object>
                {
                    IsSuccess = true,
                    Result = "Deleted successful",
                    Message = "Label with ID = " + id + " is deleted by UserId = " + userId + "."
                }));
            }
            return(NotFound(
                       new ApiResponse <string>
            {
                IsSuccess = false,
                Result = "Not found.",
                Message = "No data exist for Id = " + id
            }));
        }