예제 #1
0
 public Company Get(string name)
 {
     using (var context = new WebDal())
     {
         return(context.Companies.FirstOrDefault(a => a.Name == name && !a.IsDeleted));
     }
 }
예제 #2
0
 public IEnumerable <Company> GetAll()
 {
     using (var context = new WebDal())
     {
         return(context.Companies.Where(x => !x.IsDeleted).ToList());
     }
 }
예제 #3
0
 public Company Get(int id)
 {
     using (var context = new WebDal())
     {
         return(context.Companies.FirstOrDefault(a => a.Id == id && !a.IsDeleted));
     }
 }
예제 #4
0
 public void Update(Company item)
 {
     using (var context = new WebDal())
     {
         context.Entry(item).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
예제 #5
0
        public int Add(Company item)
        {
            using (var context = new WebDal())
            {
                context.Companies.Add(item);
                context.SaveChanges();

                return(item.Id);
            }
        }
예제 #6
0
        /// <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);
        }
예제 #7
0
 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();
     }
 }
예제 #8
0
 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);
     }
 }
예제 #9
0
 /// <summary>
 /// 批量删除站点
 /// </summary>
 /// <param name="ids">站点编号集合</param>
 public int BatchDelete(string ids)
 {
     return(WebDal.BatchDelete(ids));
 }
예제 #10
0
 /// <summary>
 /// 删除站点
 /// </summary>
 /// <param name="id">站点编号</param>
 public int Delete(string id)
 {
     return(WebDal.Delete(id));
 }
예제 #11
0
 /// <summary>
 /// 编辑站点数据
 /// </summary>
 /// <param name="model">站点实体</param>
 /// <returns></returns>
 public int Edit(WebSites model)
 {
     return(WebDal.Edit(model));
 }
예제 #12
0
 /// <summary>
 /// 添加站点信息
 /// </summary>
 /// <param name="model">站点实体</param>
 public int Add(WebSites model)
 {
     return(WebDal.Add(model));
 }