コード例 #1
0
        public async Task <IActionResult> Delete(int id, int page = 1)
        {
            if (User.Identity.IsAuthenticated)
            {
                var deleteStatus = await _mealEntryService.DeleteMealEntryAsync(id);

                if (!deleteStatus)
                {
                    return(RedirectToAction("Index", "EditEntries", new { error = true, msgToDisplay = "An error has occured with the database." }));
                }
                return(RedirectToAction("Index", "EditEntries", new { id = page, deleted = true, msgToDisplay = "Meal entry has successfully been deleted." }));
            }
            return(RedirectToAction("Index", "NotAuthorized"));
        }
コード例 #2
0
 public async Task <bool> DeleteMealEntry(int entryId)
 {
     return(await _mealEntryService.DeleteMealEntryAsync(entryId));
 }