예제 #1
0
        public async Task <IActionResult> Delete(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            try
            {
                var result = await _tagServices.DeleteAsync(id);

                if (!result)
                {
                    return(BadRequest());
                }
            }
            catch (NullReferenceException)
            {
                return(NotFound());
            }
            catch (Exception)
            {
                return(BadRequest());
            }

            return(RedirectToAction(nameof(Index)));
        }
예제 #2
0
        public async Task <IActionResult> DeleteAsync([FromBody] Tag tag)
        {
            var durum = await _tagServices.DeleteAsync(tag);

            if (durum.Errors != null)
            {
                return(Ok(durum));
            }
            return(BadRequest(durum));
        }