public async Task <JsonResult> Delete(int id)
        {
            OperationResult result = await _brandManager.Delete(id);

            var message = result.Type == ResultType.Success
                ? "Brand has been deleted"
                : result.BuildMessage();

            var title = "Completed";

            if (result.Type == ResultType.Error)
            {
                title = "Attention";
            }
            else if (result.Type == ResultType.Warning)
            {
                title = "Oops";
            }

            return(Json(new
            {
                title,
                message,
                MessageType = result.Type.ToString().ToLower()
            }));
        }
Example #2
0
        public IActionResult Delete(Brand brand)
        {
            var result = _brandManager.Delete(brand);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Example #3
0
        public async Task <ActionResult <BrandApi> > Delete(string id)
        {
            var brand = await _brandManager.Delete(id);

            return(Ok(_mapper.Map <BrandApi>(brand)));
        }