/// <summary> /// Adding a room type to the database /// </summary> /// <param name="roomType">RoomType object</param> public bool Create(RoomType roomType) { try { var entity = new RoomTypeEntity { Name = roomType.Name, IsDeleted = roomType.IsDeleted }; _hotelDbContext.RoomTypes.Add(entity); return(true); } catch { return(false); } }
public GetProjectRoleBaseInfoResultEntity Post(GetProjectRoleBaseInfoRequestModel req) { Logger.LogDebug("GetProjectRoleBaseInfo Request:" + JsonHelper.SerializeObject(req), "GetProjectRoleBaseInfoController", "Post"); var ret = new GetProjectRoleBaseInfoResultEntity() { Code = 0, ErrMsg = "" }; try { if (_projectBLL.GetModels(x => x.ID == req.ProjectID).FirstOrDefault() == null) { ret.Code = 201; ret.ErrMsg = "项目ID不存在!"; } else { var _dbprojectGroupList = _projectGroupBLL.GetModels(x => x.ProjectID == req.ProjectID).ToList(); var _projectGroupList = new List <ProjectGroupSingleEntity>(); foreach (var proGrp in _dbprojectGroupList) { var _proGrp = new ProjectGroupSingleEntity() { ProjectGroupID = proGrp.ID, ProjectGroupName = proGrp.ProjectGroupName }; _projectGroupList.Add(_proGrp); } ret.ProjectGroupList = _projectGroupList; var _dbroomTypeList = _houseBLL.GetModels(x => x.ProjectID == req.ProjectID).Select(x => x.RoomType).Distinct().OrderBy(x => x.ID).ToList(); var _roomTypeList = new List <RoomTypeEntity>(); foreach (var room in _dbroomTypeList) { var _room = new RoomTypeEntity() { RoomTypeID = room.ID, RoomTypeName = room.Name }; _roomTypeList.Add(_room); } ret.RoomTypeList = _roomTypeList; var _dbhouseGroupList = _houseGroupBLL.GetModels(x => x.ProjectID == req.ProjectID).ToList(); var _houseGroupList = new List <HouseGroupEntity>(); foreach (var houseGroup in _dbhouseGroupList) { var _houseGroup = new HouseGroupEntity() { HouseGroupID = houseGroup.ID, HouseGroupName = houseGroup.Name }; _houseGroupList.Add(_houseGroup); } ret.HouseGroupList = _houseGroupList; var _dbfamilyNumberList = _subscriberMapping.GetModels(x => x.ProjectID == req.ProjectID).Select(x => x.Subscriber.FamilyMemberNumber + 1).Distinct().ToList(); ret.FamilyNumber = _dbfamilyNumberList; } } catch (Exception ex) { Logger.LogException("", "", "", ex); ret.Code = 999; ret.ErrMsg = ex.Message; } return(ret); }
/// <summary> /// Obtem quarto pelo tipo. Single, Standard ou Lux. /// </summary> /// <param name="roomTypeEntity"></param> /// <returns></returns> public List <RoomEntity> GetByType(RoomTypeEntity roomTypeEntity) { return(_roomRepository.Find(x => x.Type.RoomType == roomTypeEntity.RoomType)); }
/// <summary> /// Obtem quarto por tipo. /// </summary> /// <param name="roomType"></param> /// <returns></returns> public List <RoomEntity> GetByType(RoomTypeEntity roomType) { var rooms = _roomBusiness.GetByType(roomType); return(rooms); }