Пример #1
0
        public async Task <JsonResult> DeleteThighConfirmed(int id)
        {
            var user = await userManager.FindByIdAsync(User.Identity.GetUserId());

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

            if (measurement == null)
            {
                return(Json("Deleted unsuccessfully"));
            }
            if (measurement.ApplicationUser.Id != user.Id)
            {
                return(Json("Deleted unsuccessfully"));
            }
            thighMeasurementService.Delete(id);
            return(Json("Deleted successfully"));
        }