Esempio n. 1
0
        public async Task <IActionResult> Delete(int id)
        {
            var changes = await _recipesService.Delete(id);

            if (changes == 0)
            {
                return(NotFound());
            }

            return(NoContent());
        }
 public ActionResult <Recipe> Delete(int id)
 {
     try
     {
         return(Ok(_rs.Delete(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Esempio n. 3
0
 public ActionResult <string> Delete(int id)
 {
     try
     {
         _service.Delete(id);
         return(Ok("deleted"));
     }
     catch (System.Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Esempio n. 4
0
        public async Task <ActionResult <Recipe> > Delete(int id)
        {
            try
            {
                Account userInfo = await HttpContext.GetUserInfoAsync <Account>();

                _service.Delete(id, userInfo.Id);
                return(Ok("Deleted"));
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Esempio n. 5
0
        public async Task <ActionResult <Recipe> > Delete(int id)
        {
            try
            {
                Account userInfo = await HttpContext.GetUserInfoAsync <Account>();

                _rService.Delete(id, userInfo.Id);
                return(Ok("Delorted"));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
        public async Task <ActionResult <Recipe> > Delete(int id)
        {
            try
            {
                // TODO[epic=Auth] Get the user info to set the creatorID
                Account userInfo = await HttpContext.GetUserInfoAsync <Account>();

                // safety to make sure an account exists for that user before CREATE-ing stuff.
                _serviceVAR.Delete(id, userInfo.Id);
                return(Ok("Delorted"));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
 public IActionResult Delete(int id)
 {
     RecipesService.Delete(id);
     return(RedirectToAction("ModifyOverview"));
 }