public BlockListModel(BlockList blockList) :base(blockList) { if(blockList != null) { Application_Id = blockList.Application_Id; BlockType_Id = blockList.BlockType_Id; Content = blockList.Content; } }
public void UpdateBlockList(int appid, int userId, string token, BlockList blockL) { try { CheckToken(appid, userId, token); CheckCommand(appid, blockL.Application_Id, userId, BuiltIns.BlockCommand.Id, BuiltIns.AllRole.Id); using (TransactionScope scope = new TransactionScope()) { modelAccesser.Update<BlockList>(blockL); if (!string.IsNullOrEmpty(blockL.Content)) { modelAccesser.Add<BlockHistory>(new BlockHistory { Application_Id = blockL.Application_Id, BlockType_Id = blockL.BlockType_Id, Content = blockL.Content, IsBlock = true, OptUser_Id = userId, Time = DateTime.Now }); } scope.Complete(); } } catch (Exception) { throw new DatabaseException(); } }
public void DeleteBlockList(int appid, int userId, string token, int id) { try { CheckToken(appid, userId, token); BlockList blockL = new BlockList { Id = id }; modelAccesser.Get<BlockList>(blockL); if (blockL.Loaded) { CheckCommand(appid, blockL.Application_Id, userId, BuiltIns.BlockCommand.Id, BuiltIns.AllRole.Id); using (TransactionScope scope = new TransactionScope()) { modelAccesser.Add<BlockHistory>(new BlockHistory { Application_Id = blockL.Application_Id, BlockType_Id = blockL.BlockType_Id, Content = blockL.Content, IsBlock = false, OptUser_Id = userId, Time = DateTime.Now }); modelAccesser.Delete(blockL); scope.Complete(); } } } catch (Exception) { throw new DatabaseException(); } }
public BlockList GetBlockList(int appid, int userId, string token, int id) { try { CheckToken(appid, userId, token); BlockList list = new BlockList { Id = id }; modelAccesser.Get<BlockList>(list); return list.Loaded ? list : null; } catch (Exception) { throw new DatabaseException(); } }
public JsonResult NewBlockList() { BlockList list = new BlockList { Application_Id = BuiltIns.AllApplication.Id, BlockType_Id = BuiltIns.BlockUserType.Id, Content = string.Empty }; string message = string.Empty; bool success = false; try { AddEntity<BlockList>(list); success = true; } catch (DatabaseException exception) { message = exception.Message; } return Json(new {Success = success,Model = new BlockListModel(list), Message = message}, JsonRequestBehavior.AllowGet); }
public void UpdateBlockList(int userId, string token, YoYoStudio.Model.Core.BlockList blockL) { client.UpdateBlockList(application_Id, userId, token, blockL); }
public YoYoStudio.Model.Core.BlockList AddBlockList(int userId, string token, YoYoStudio.Model.Core.BlockList blockL) { return(client.AddBlockList(application_Id, userId, token, blockL)); }