Exemple #1
0
        public 房间类型DTO GetDTO(int?Id)
        {
            var dTO = new 房间类型DTO();

            if (Id != null)
            {
                dTO = Mapper.Map <房间类型DTO>(_iRoomTypeRep.GetById(Id.Value));
            }
            return(dTO);
        }
Exemple #2
0
        public List <房间类型DTO> List(房间类型DTO dto)
        {
            var libiao = _iRoomTypeRep.Entities;

            if (dto.CompanyId != null)
            {
                libiao = libiao.Where(m => m.CompanyId == dto.CompanyId);
            }
            libiao = libiao.OrderByDescending(m => m.Id);
            //var libiao = _iRoomTypeRep.Entities.Where(m => m.CompanyId == 1).OrderByDescending(m => m.Id);
            return(Mapper.Map <List <房间类型>, List <房间类型DTO> >(libiao.ToList()));
        }
Exemple #3
0
 public 房间类型DTO Save(房间类型DTO dto)
 {
     try
     {
         var model = Mapper.Map <房间类型> (dto);
         if (dto.Id > 0)
         {
             _iRoomTypeRep.Update(model);
         }
         else
         {
             dto.Id = _iRoomTypeRep.Insert(model);
         }
         //result.code = "0";
         //result.msg = "保存成功";
         return(dto);
     }
     catch (Exception er)
     {
         throw er;
     }
 }
Exemple #4
0
 public 房间类型DTO Del(房间类型DTO dto)
 {
     dto.Id = _iRoomTypeRep.Delete(dto.Id);
     return(dto);
 }