public IActionResult AddPrivilege(privilegeModel viewModel) { if (!ModelState.IsValid) { ShowTipMessage(LayerIconType.Sigh, "", false); return(View(viewModel)); } var result = _database.Insert <privilegeModel>(viewModel); ShowTipMessage(result > 0 ? LayerIconType.Success : LayerIconType.Erro, "", result > 0); return(View(viewModel)); }
public IActionResult EditPrivilege(privilegeModel viewModel) { if (!ModelState.IsValid) { ShowTipMessage(LayerIconType.Sigh, "", false); return(View(viewModel)); } var result = _database.UpdateSet <privilegeModel>( new { viewModel.id, viewModel.name, viewModel.type, viewModel.resource, viewModel.remark, viewModel.modifyon }); ShowTipMessage(result ? LayerIconType.Success : LayerIconType.Erro, "", result); return(View(viewModel)); }