public ActionResult ShowHide(string key, string lstArrId, bool showhide) { var msg = new JsonMessage(false, "Cập nhật dữ liệu thành công."); try { var lstInt = FDIUtils.StringToListInt(lstArrId); var lst = _da.GetListArrId(lstInt); foreach (var item in lst) { item.IsShow = showhide; } _da.Save(); } catch (Exception ex) { Log2File.LogExceptionToFile(ex); msg.Erros = true; msg.Message = "Dữ liệu chưa được cập nhật"; } return(Json(msg, JsonRequestBehavior.AllowGet)); }
public ActionResult Actions() { var msg = new JsonMessage(); switch (DoAction) { case ActionType.Edit: msg = new JsonMessage(false, "Cập nhât dữ liệu thành công."); try { var model = _da.GetById(ArrId.FirstOrDefault()); UpdateModel(model); _da.Save(); } catch (Exception) { msg.Erros = true; msg.Message = "Dữ liệu chưa được cập nhật."; } break; case ActionType.Delete: msg = new JsonMessage(false, "Xóa dữ liệu thành công."); try { var lst = _da.GetListArrId(ArrId); foreach (var item in lst) { item.IsDeleted = true; } _da.Save(); } catch (Exception ex) { msg.Erros = true; msg.Message = "Dữ liệu chưa được xóa"; } break; default: msg.Message = "Không có hành động nào được thực hiện."; msg.Erros = true; break; } return(Json(msg, JsonRequestBehavior.AllowGet)); }