示例#1
0
        public 企业用户DTO GetDTO(int?Id)
        {
            var dTO = new 企业用户DTO();

            if (Id != null)
            {
                dTO = Mapper.Map <企业用户DTO>(_iNewsRep.GetById(Id.Value));
            }
            return(dTO);
        }
示例#2
0
        public List <企业用户DTO> List(企业用户DTO dto)
        {
            var libiao = _iNewsRep.Entities;

            if (dto.Cid > 0)
            {
                libiao = libiao.Where(r => r.Cid == dto.Cid);
            }
            if (!string.IsNullOrEmpty(dto.CompanyName))
            {
                libiao = libiao.Where(r => r.CompanyName.Contains(dto.CompanyName));
            }
            libiao = libiao.OrderByDescending(m => m.Id);
            //var libiao = _iRoomTypeRep.Entities.Where(m => m.CompanyId == 1).OrderByDescending(m => m.Id);
            return(Mapper.Map <List <企业用户DTO> >(libiao.ToList()));
        }
示例#3
0
 public 企业用户DTO Save(企业用户DTO dto)
 {
     try
     {
         var model = Mapper.Map <企业用户> (dto);
         if (dto.Id > 0)
         {
             _iNewsRep.Update(model);
         }
         else
         {
             dto.Id = _iNewsRep.Insert(model);
         }
         //result.code = "0";
         //result.msg = "保存成功";
         return(dto);
     }
     catch (Exception er)
     {
         throw er;
     }
 }
示例#4
0
 public 企业用户DTO Del(企业用户DTO dto)
 {
     dto.Id = _iNewsRep.Delete(dto.Id);
     return(dto);
 }