Ejemplo n.º 1
0
 public Room(double roomping, int windows, roomtype roomtype, int level)
 {
     Roomping = roomping;
     Windows  = windows;
     Roomtype = roomtype;
     Level    = level;
 }
Ejemplo n.º 2
0
        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));
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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));
            }
        }