public Room(double roomping, int windows, roomtype roomtype, int level) { Roomping = roomping; Windows = windows; Roomtype = roomtype; Level = level; }
public ResultHelper AddRoomType(RoomTypeDto roomTypeDto) { try { if (IsThere(roomTypeDto)) { return(new ResultHelper(false, roomTypeDto.RoomTypeID, ResultHelper.IsThereItem)); } roomtype item = new roomtype(); item.RoomTypeID = roomTypeDto.RoomTypeID; item.Name = roomTypeDto.Name; item.Description = roomTypeDto.Description; using (UnitOfWork unitofWork = new UnitOfWork()) { unitofWork.GetRepository <roomtype>().Insert(item); unitofWork.saveChanges(); return(new ResultHelper(true, item.RoomTypeID, ResultHelper.SuccessMessage)); } } catch (Exception ex) { return(new ResultHelper(false, roomTypeDto.RoomTypeID, ResultHelper.UnSuccessMessage)); } }
public RoomTypeDto GetRoomType(int roomTypeID) { try { using (UnitOfWork unitofWork = new UnitOfWork()) { roomtype item = new roomtype(); item = unitofWork.GetRepository <roomtype>().GetById(x => x.RoomTypeID == roomTypeID); RoomTypeDto roomTypeDto = new RoomTypeDto(); roomTypeDto.Name = item.Name; roomTypeDto.RoomTypeID = item.RoomTypeID; roomTypeDto.Description = item.Description; return(roomTypeDto); } } catch (Exception) { return(null); } }
public ResultHelper SetRoomType(RoomTypeDto roomTypeDto) { try { roomtype item = new roomtype(); item.RoomTypeID = roomTypeDto.RoomTypeID; item.Name = roomTypeDto.Name; item.Description = roomTypeDto.Description; using (UnitOfWork unitofWork = new UnitOfWork()) { unitofWork.GetRepository <roomtype>().Update(item); unitofWork.saveChanges(); return(new ResultHelper(true, roomTypeDto.RoomTypeID, ResultHelper.SuccessMessage)); } } catch (Exception) { return(new ResultHelper(false, roomTypeDto.RoomTypeID, ResultHelper.UnSuccessMessage)); } }