public Company Get(string name) { using (var context = new WebDal()) { return(context.Companies.FirstOrDefault(a => a.Name == name && !a.IsDeleted)); } }
public IEnumerable <Company> GetAll() { using (var context = new WebDal()) { return(context.Companies.Where(x => !x.IsDeleted).ToList()); } }
public Company Get(int id) { using (var context = new WebDal()) { return(context.Companies.FirstOrDefault(a => a.Id == id && !a.IsDeleted)); } }
public void Update(Company item) { using (var context = new WebDal()) { context.Entry(item).State = EntityState.Modified; context.SaveChanges(); } }
public int Add(Company item) { using (var context = new WebDal()) { context.Companies.Add(item); context.SaveChanges(); return(item.Id); } }
/// <summary> /// 获取小说站点分页数据 /// </summary> /// <param name="paramList">查询及分页参数</param> /// <returns></returns> public List <WebSites> PageWebList(Dictionary <string, string> paramList) { var list = new List <WebSites>(); DataSet ds = WebDal.PageWebData(paramList); if (ds != null && ds.Tables[0].Rows.Count > 0) { list = new DataTableToList <WebSites>(ds.Tables[0]).ToList(); } return(list); }
public void Delete(int id) { using (var context = new WebDal()) { var db = context.Companies.FirstOrDefault(a => a.Id == id); if (db != null) { db.IsDeleted = true; } context.SaveChanges(); } }
public Company GetByUsername(string email) { using (var context = new WebDal()) { var user = context.Users .FirstOrDefault(y => y.Email == email && !y.IsDeleted); if (user == null) { return(null); } return(user.Company.IsDeleted ? null : user.Company); } }
/// <summary> /// 批量删除站点 /// </summary> /// <param name="ids">站点编号集合</param> public int BatchDelete(string ids) { return(WebDal.BatchDelete(ids)); }
/// <summary> /// 删除站点 /// </summary> /// <param name="id">站点编号</param> public int Delete(string id) { return(WebDal.Delete(id)); }
/// <summary> /// 编辑站点数据 /// </summary> /// <param name="model">站点实体</param> /// <returns></returns> public int Edit(WebSites model) { return(WebDal.Edit(model)); }
/// <summary> /// 添加站点信息 /// </summary> /// <param name="model">站点实体</param> public int Add(WebSites model) { return(WebDal.Add(model)); }