public async Task <JsonResult> deleteClassification(int?id) { if (id == null) { return(Json(new { status = JsonStatus.Error, link = "يوجد خطا", color = NotificationColor.error.ToString().ToLower(), msg = "يوجد خطا تأكد من البيانات", })); } var getClassficationDelete = classification.Find(id); if (getClassficationDelete.Id > 0) { getClassficationDelete.IsDeleted = true; getClassficationDelete.UpdatedDate = DateTime.UtcNow; getClassficationDelete.UpdateUser = USERNAME; var result = await classification.UpdateAndLogAsync(getClassficationDelete, USERNAME); if (result > 0) { return(Json(new { status = JsonStatus.Success, link = "جيد", color = NotificationColor.success.ToString().ToLower(), msg = "تم الحذف بنجاح", ObjectID = getClassficationDelete.Id })); } else { return(Json(new { status = JsonStatus.Error, link = "يوجد خطا", color = NotificationColor.error.ToString().ToLower(), ObjectID = getClassficationDelete.Id, msg = "يوجد خطا في عملية الحذف", })); } } return(Json(new { status = JsonStatus.Error, link = "", color = NotificationColor.error.ToString().ToLower(), msg = ModelState.Keys.SelectMany(k => ModelState[k].Errors) .Select(m => m.ErrorMessage).ToArray() })); }