コード例 #1
0
        public async Task <JsonResult> DeleteConfirmed(int id)
        {
            var user = await userManager.FindByIdAsync(User.Identity.GetUserId());

            if (user == null)
            {
                return(Json(HttpStatusCode.Unauthorized.ToString()));
            }
            var workout = workoutService.Get(id);

            if (workout == null)
            {
                return(Json("Deleted unsuccessfully"));
            }
            if (workout.ApplicationUser.Id != user.Id)
            {
                return(Json("Deleted unsuccessfully"));
            }
            workoutService.Delete(id);
            return(Json("Deleted successfully"));
        }
コード例 #2
0
 public void Delete(int id)
 {
     _workourService.Delete(id);
 }