public ReceptionistDto GetReceptionist(long receptionistId) { var receptionist = _receptionistService.Find(receptionistId); if (receptionist == null) { throw new NotFoundException(ErrorCodes.UserNotFound); } if (receptionist.IsDeleted) { throw new NotFoundException(ErrorCodes.UserNotFound); } return(Mapper.Map <ReceptionistDto>(receptionist)); }
public List <RoomNameDto> GetAllRoomNames(long userId, string role) { List <RoomNameDto> rooms = null; if (role == Enums.RoleType.Admin.ToString()) { rooms = Mapper.Map <List <RoomNameDto> >(_roomService.Query(x => !x.IsDeleted && x.AdminId == userId).Select().ToList()); } else if (role == Enums.RoleType.Supervisor.ToString()) { var adminId = _supervisorService.Find(userId).AdminId; rooms = Mapper.Map <List <RoomNameDto> >(_roomService.Query(x => !x.IsDeleted && x.AdminId == adminId).Select().ToList()); } else if (role == Enums.RoleType.Receptionist.ToString()) { var adminId = _receptionistService.Find(userId).AdminId; rooms = Mapper.Map <List <RoomNameDto> >(_roomService.Query(x => !x.IsDeleted && x.AdminId == adminId).Select().ToList()); } else if (role == Enums.RoleType.Waiter.ToString()) { var waiter = _restaurantWaiterService.Find(userId); rooms = Mapper.Map <List <RoomNameDto> >(_roomService.Query(x => !x.IsDeleted && x.AdminId == waiter.Branch.Restaurant.AdminId).Select().ToList()); } return(rooms); }
public List <FeatureNameDto> GetAllFeatureName(long userId, string userRole) { List <FeatureNameDto> features = null; if (userRole == Enums.RoleType.Admin.ToString()) { features = Mapper.Map <List <FeatureNameDto> >(_featureService.Query(x => x.CreationBy == userId && !x.IsDeleted && x.IsActive).Select().ToList()); } else if (userRole == Enums.RoleType.Supervisor.ToString()) { features = Mapper.Map <List <FeatureNameDto> >(_supervisorFeatureService.Query(x => x.SupervisorId == userId && !x.Feature.IsDeleted && x.Feature.IsActive).Select(x => x.Feature).ToList()); } else if (userRole == Enums.RoleType.Receptionist.ToString()) { var adminId = _receptionistService.Find(userId).AdminId; features = Mapper.Map <List <FeatureNameDto> >(_featureService.Query(x => x.CreationBy == adminId && !x.IsDeleted && x.IsActive).Select().ToList()); } return(features); }