public async Task <IActionResult> DeleteAsync(int id)
        {
            var result = await _ownerService.DeleteAsync(id);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }
            var ownerResource = _mapper.Map <Owner, OwnerResource>(result.Resource);

            return(Ok(ownerResource));
        }
示例#2
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var owner = await _ownerService.GetAsync(id);

                if (owner != null)
                {
                    await _ownerService.DeleteAsync(owner);
                }
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View("Error", ex));
            }
        }
示例#3
0
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                var carBrand = await _ownerService.GetAsync(id);

                if (carBrand != null)
                {
                    var result = await _ownerService.DeleteAsync(carBrand);

                    if (result == -1)
                    {
                        return(BadRequest("Error delete"));
                    }
                }
                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public async Task <IActionResult> DeleteOwner(int id)
        {
            await _ownerService.DeleteAsync(id);

            return(Ok());
        }
        public async Task <IActionResult> RemoveOwner(string login)
        {
            await _ownerService.DeleteAsync(login);

            return(Ok());
        }