public Models.Review First(Models.ReviewSearchModel conditions = null, string userName = null) { try { var entity = RestfulNews.First(conditions); if (!NewsAccessControl.Pass(RestfulAction.Read, entity, userName)) { throw new NoAccessException("No Access"); } return(entity); } catch { throw; } }
public bool Delete(int id, string userName) { try { var entity = RestfulNews.Read(id); if (!NewsAccessControl.Pass(RestfulAction.Delete, entity, userName)) { throw new NoAccessException("No Access"); } return(RestfulNews.Delete(id)); } catch { throw; } }
public Models.Review Read(int id, string userName = null) { try { var entity = RestfulNews.Read(id); if (!NewsAccessControl.Pass(RestfulAction.Read, entity, userName)) { throw new NoAccessException("No Access"); } return(entity); } catch { throw; } }
public Models.Review Create(Models.Review entity, string userName) { try { if (!NewsAccessControl.Pass(RestfulAction.Create, entity, userName)) { throw new NoAccessException("No Access"); } entity.Creator = userName; entity.Created = DateTime.Now; return(RestfulNews.Create(entity)); } catch { throw; } }
public Models.Review Update(int id, Models.Review entity, string userName) { try { var old = RestfulNews.Read(id); if (!NewsAccessControl.Pass(RestfulAction.Update, old, userName)) { throw new NoAccessException("No Access"); } entity.ProductId = old.ProductId; entity.Creator = userName; entity.Created = old.Created; entity.Updated = DateTime.Now; return(RestfulNews.Update(id, entity)); } catch { throw; } }