public Models.Vote First(Models.VoteSearchModel conditions = null, string userName = null) { try { var entity = RestfulVote.First(conditions); if (!VoteAccessControl.Pass(RestfulAction.Read, entity, userName)) { throw new NoAccessException("No Access"); } return(entity); } catch { throw; } }
public Models.Vote Read(int id, string userName = null) { try { var entity = RestfulVote.Read(id); if (!VoteAccessControl.Pass(RestfulAction.Read, entity, userName)) { throw new NoAccessException("No Access"); } return(entity); } catch { throw; } }
public bool Delete(int id, string userName) { try { var entity = RestfulVote.Read(id); if (!VoteAccessControl.Pass(RestfulAction.Delete, entity, userName)) { throw new NoAccessException("No Access"); } return(RestfulVote.Delete(id)); } catch { throw; } }
public Models.Vote Create(Models.Vote entity, string userName) { try { if (!VoteAccessControl.Pass(RestfulAction.Create, entity, userName)) { throw new NoAccessException("No Access"); } entity.Creator = userName; entity.Created = DateTime.Now; return(RestfulVote.Create(entity)); } catch { throw; } }