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